목록전체 글 (268)
정화 코딩

https://www.acmicpc.net/problem/31870 #include #include #include using namespace std;int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n; cin >> n; vector a(n); for (int i = 0; i > a[i]; int ans = 1000000000; for (int k = 0; k at = a; int cnt = 0; for (int i = n - 1; i > 0; i--) { if (i == k) { reverse(at.b..

https://www.acmicpc.net/problem/16677 #include using namespace std;int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); string s; int n; cin >> s >> n; int sn = s.size(); double ans = 0; string anss = "No Jam"; while (n--) { string a; double g; cin >> a >> g; int an = a.size(); int cnt = 0; int idx1 = 0; ..

https://www.acmicpc.net/problem/1308 #include using namespace std;bool isleap(int n) { if (n % 4 == 0) { if (n % 100 == 0) { if (n % 400 == 0) return true; else return false; } return true; } return false;}int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int month[13] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, ..

https://www.acmicpc.net/problem/11048 #include #include #include using namespace std;int dx[3] = {1, 0, 1};int dy[3] = {0, 1, 1};vector> a;int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n, m; cin >> n >> m; a = vector>(n, vector(m)); for (int i = 0; i > a[i][j]; } } queue> q; q.push({0, 0, a[0][0]}); int ans = 0; while (!q.empty..

https://www.acmicpc.net/problem/9048 #include #include using namespace std;int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int t; cin >> t; while (t--) { int f, r, n; cin >> f >> r >> n; int ans = 2 * f + (r + 1); vector up(f + 1, 0); vector down(f + 1, r + 1); for (int i = 0; i > a >> b; if (b 처음에는 각 ..

https://www.acmicpc.net/problem/9935 #include #include #include using namespace std;int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); string s, bomb; cin >> s >> bomb; stack stk; int n = bomb.size(); for (char c: s) { if (c == bomb[n - 1]) { for (int i = n - 2; i >= 0; i--) { if (stk.empty()) { for (int..

https://www.acmicpc.net/problem/5639 #include #include using namespace std;vector a;void post(int s, int e) { if (s >= e) return; int idx = e; for (int i = s + 1; i a[s]) { idx = i; break; } } post(s + 1, idx); post(idx, e); cout > x) { a.push_back(x); } int n = a.size(); post(0, n);} 이 문제는 트리 구조를 만들어서 뭔갈 한다기 보다는 어떻게 하면 전위 순회..

https://www.acmicpc.net/problem/10174 #include using namespace std;int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int tn; cin >> tn; while (tn--) { string s; getline(cin, s); int n = s.length(); for (int i = 0; i = 'A' && s[i] 공백이 들어올 수 있기 때문에 string으로 받는 것이 아니라 한 줄 전체를 받아야 한다.C++ 한 줄 입력받기: getline(cin, s);근데 위의 코드를 돌리면 반복문이 n-1번..