코드포스
-
1622-B코드포스 2021. 12. 29. 20:38
Problem - B - Codeforces codeforces.com 풀이 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 #include #define endl "\n" #define ooop(i, n) for(int i = 0; i t; while(t--){ int n; cin >> n; vector p(n); for(auto& e: p) cin >> e; string pre; cin >> pre; priority_queue pq_dislike; priority_qu..
-
1303-D, *1900코드포스 2021. 12. 26. 14:33
Problem - D - Codeforces codeforces.com 풀이 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 #include #define endl "\n" #define ooop(i, n) for(int i = 0; i t; make_exponent(exponent); while(t--){ ll n, m; cin >> n >> m; vector cnt(30); ll a, sum = 0; loop(i, m){..
-
1303-C, *1600코드포스 2021. 12. 26. 14:30
Problem - C - Codeforces codeforces.com 풀이 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 #include #define endl "\n" #define ooop(i, n) for(int i = 0; i t; while(t--){ string s; cin >> s; if(s.size() == 1){ stri..
-
1303-B, *1400코드포스 2021. 12. 26. 14:29
Problem - B - Codeforces codeforces.com 풀이 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 #include #define endl "\n" #define ooop(i, n) for(int i = 0; i t; while(t--){ ll n, g, b; cin >> n >> g >> b; ll req = (n+1)/2; ll q = req/g; ll r = req%g; ll nes = 0; if(r == 0) nes = (g+b)*(q-1)+g; else nes = (g+b)*q+r; cout
-
1615-C코드포스 2021. 12. 25. 21:10
Problem - C - Codeforces codeforces.com 풀이 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 #include #define endl "\n" #define ooop(i, n) for(int i = 0; i t; while(t--){ int n; cin >> n; string a, b; cin >> a >> b; int diff_cnt = 0; int diff_one = 0; int same_one = 0; ooop(i, n){ i..
-
1615-B코드포스 2021. 12. 25. 21:08
Problem - B - Codeforces codeforces.com 풀이 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 #include #define endl "\n" #define ooop(i, n) for(int i = 0; i > l >> r; int minval = INT_MAX; ooop(bit, 18){ int tmp = zero_cnt(bit, r) - zero_cnt(bit, l-1); if(tmp
-
1615-A코드포스 2021. 12. 25. 21:07
Problem - A - Codeforces codeforces.com 풀이 n |합 -> 0 그 외 1 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 #include #define endl "\n" #define ooop(i, n) for(int i = 0; i t; while(t--){ int n; cin >> n; int sum = 0; loop(i, n){ int tmp; cin >> tmp; sum += tmp; } cout
-
1301-B, *1500코드포스 2021. 12. 24. 02:35
Problem - B - Codeforces codeforces.com 풀이 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 #include #define endl "\n" #define ooop(i, n) for(int i = 0; i t; int n; while(t--){ cin >> n; vector v(n+1); loop(i, n) cin >> v[i]; int maxval = -1, minval = 1e9+1; int fixed_gap = -1; loo..