목록C++ (125)
정화 코딩

https://www.acmicpc.net/problem/5525 #include #include using namespace std;int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n, m; string str; cin >> n >> m >> str; int l = 2 * n + 1; string ioi = ""; for (int i = 0; i 이 문제는 서브태스크 문제였는데, 이 코드로는 50점이 나온다. 앞에서부터 substring을 하나하나 비교하는 방식인데, 정답을 받으려면 더 빠른 방법이 필요한 것 같다. (PA) #include #include using name..

https://www.acmicpc.net/problem/9019 #include #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 start, end; cin >> start >> end; vector vst(10000, false); queue> q; q.emplace(start, ""); vst[start] = true; while (!q.empty()) { in..

https://www.acmicpc.net/problem/30804 #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 si = 0; int ei = 0; int maxcnt = 0; int cnt = 0; set chk; while (chk.size() maxcnt) maxcnt = cnt; } } while (chk.size() ..

https://www.acmicpc.net/problem/7662 #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 k; cin >> k; int cnt = 0; priority_queue maxq; priority_queue minq; while (k--) { char op; int x; cin >> op >> x; if..

https://www.acmicpc.net/problem/12761 #include #include #include using namespace std;bool vst[1000001];int dir[] = {-1, 1, 0, 0, 0, 0};int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int a, b, n, m; cin >> a >> b >> n >> m; dir[2] = a; dir[3] = a * (-1); dir[4] = b; dir[5] = b * (-1); queue> q; q.emplace(n, 0); vst[n] = true; while (!q.e..

https://www.acmicpc.net/problem/25333 #include #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 a, b, x; cin >> a >> b >> x; vector chk(x + 1, false); queue q; q.push(0); chk[0] = true; int cnt = 0; while (!q.empty()) { i..

https://www.acmicpc.net/problem/11727 #include #include using namespace std;int mod = 10007;int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n; cin >> n; vector dp(n + 1, 0); dp[1] = 1; if (n > 1) dp[2] = 3; for (int i = 3; i 점화식: dp[n] = (2 * dp[n - 2] + dp[n - 1]) % mod(n - 2)까지 채운 것에 1 * 2 타일 2개 또는 2 * 2 타일 1개 붙이기 + (n - 1)까지 채운 것에 1 * 2 타일 1개..

https://www.acmicpc.net/problem/7696 #include #include #include using namespace std;int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); while (true) { int n; cin >> n; if (n == 0) break; int i = 1; while (i chk(10, false); while (tmp > 0) { if (chk[tmp % 10]) { eq = true; ..