본문 바로가기
반응형

C++162

[백준/BOJ] 18258번 - 큐 2 (C++) 문제 링크 코드 #include using namespace std; int main(void) { ios::sync_with_stdio(0); cin.tie(0); string s; queue Q; int n, x; cin >> n; while (n--) { cin >> s; if (s == "push") { cin >> x; Q.push(x); } else if (s == "pop") { if (Q.empty()) cout 2022. 3. 26.
[백준/BOJ] 17215번 - 볼링 점수 계산 (C++) 문제 링크 코드 #include using namespace std; int score[10]; int main(void) { ios::sync_with_stdio(0); cin.tie(0); string s; cin >> s; int frame = 0, times = 0; int i = 0, max_times = 2; while (frame = '0' && s[i] 0 && (s[i-1] == 'S' || s[i-1] ==.. 2022. 3. 26.
[백준/BOJ] 17211번 - 좋은 날 싫은 날 (C++) 문제 링크 코드 #include using namespace std; int main(void) { ios::sync_with_stdio(0); cin.tie(0); int n, curr; double gg, gb, bg, bb; vector good, bad; cin >> n >> curr; cin >> gg >> gb >> bg >> bb; if (curr == 0) { good.push_back(gg); bad.push_back(gb); } else { good.push_back(bg); bad.push_back(bb); } for (int i = 1; i < n; i++) { good.push_back(good[i-1] * gg + bad[i-1] * bg); bad.push_back(good[i.. 2022. 3. 26.
[백준/BOJ] 17210번 - 문문문 (C++) 문제 링크 코드 #include using namespace std; int main(void) { ios::sync_with_stdio(0); cin.tie(0); int n, a; cin >> n >> a; if (n > 5) cout 2022. 3. 26.
[백준/BOJ] 16435번 - 스네이크버드 (C++) 문제 링크 코드 #include using namespace std; int main(void) { ios::sync_with_stdio(0); cin.tie(0); int n, l, i; cin >> n >> l; vector h(n); for (i = 0; i > h[i]; sort(h.begin(), h.end()); for (i = 0; i < n; i++) { if (l < h[i]) break; l++; } cout 2022. 3. 26.
[백준/BOJ] 15947번 - 아기 석환 뚜루루 뚜루 (C++) 문제 링크 코드 #include using namespace std; int main(void) { ios::sync_with_stdio(0); cin.tie(0); int n; cin >> n; vector v = { "baby", "sukhwan", "tururu", "turu", "very", "cute", "tururu", "turu", "in", "bed", "tururu", "turu", "baby", "sukhwan" }; int idx = (n - 1) % 14; string ret = v[idx]; if (ret == "tururu" || ret == "turu") { for (int i = 0; i = 1.. 2022. 3. 25.
[백준/BOJ] 15552번 - 빠른 A+B (C++) 문제 링크 코드 #include using namespace std; int main(void) { ios::sync_with_stdio(0); cin.tie(0); int t, a, b; cin >> t; while (t--) { cin >> a >> b; cout 2022. 3. 25.
[백준/BOJ] 14487번 - 욱제는 효도쟁이야!! (C++) 문제 링크 코드 #include using namespace std; int main(void) { ios::sync_with_stdio(0); cin.tie(0); int n, t, mx = 0, ans = 0; cin >> n; while (n--) { cin >> t; mx = max(mx, t); ans += t; } cout 2022. 3. 25.
[백준/BOJ] 11866번 - 요세푸스 문제 0 (C++) 문제 링크 코드 #include using namespace std; int main(void) { ios::sync_with_stdio(0); cin.tie(0); queue Q; int n, k, i; cin >> n >> k; for (i = 1; i 2022. 3. 25.
[백준/BOJ] 11724번 - 연결 요소의 갯수 (C++) 문제 링크 코드 #include using namespace std; vector p[1001]; bool vis[1001]; int n, m, a, b, ans = 0; void bfs(int x) { queue Q; Q.push(x); vis[x] = 1; while (!Q.empty()) { x = Q.front(); Q.pop(); for (int i = 0; i > n >> m; while (m--) { cin >> a >> b; p[a].p.. 2022. 3. 25.
반응형