ABC154B - I miss you...
#include <iostream> #include <string> using namespace std; #define REP(i, n) for (int i = 0; i < (n); ++i) int main(void) { string s; cin.tie(0); ios::sync_with_stdio(false); cin >> s; REP(i, s.length()) { cout << "x"; if (i == s.length() - 1) { cout << "\n"; } } return 0; }
ABC154A - Remaining Balls
#include <iostream> #include <string> using namespace std; int main(void) { string s, t, u; int a, b; cin.tie(0); ios::sync_with_stdio(false); cin >> s >> t; cin >> a >> b; cin >> u; if (s == u) { --a; } else { --b; } cout << a << " " << b << "\n"; return 0; }
ABC153B - Common Raccoon vs Monster
問題:B - Common Raccoon vs Monster
#include <iostream> using namespace std; #define REP(i, n) for (int i = 0; i < (n); ++i) int main(void) { int h, n, a; cin.tie(0); ios::sync_with_stdio(false); cin >> h >> n; REP(i, n) { cin >> a; h -= a; } cout << (h <= 0? "Yes" : "No") << "\n"; return 0; }
ABC153A - Serval vs Monster
#include <iostream> using namespace std; int main(void) { int h, a; cin.tie(0); ios::sync_with_stdio(false); cin >> h >> a; cout << (h % a == 0? h / a : h / a + 1) << "\n"; return 0; }
ABC152B - Comparing Strings
#include <algorithm> #include <iostream> using namespace std; #define REP(i, n) for (int i = 0; i < (n); ++i) int main(void) { char a, b; cin.tie(0); ios::sync_with_stdio(false); cin >> a >> b; REP(i, max(a - '0', b - '0')) { cout << min(a - '0', b - '0'); } cout << "\n"; return 0; }
ABC152A - AC or WA
問題:A - AC or WA
#include <iostream> using namespace std; int main(void) { int n, m; cin.tie(0); ios::sync_with_stdio(false); cin >> n >> m; cout << (n == m? "Yes" : "No") << "\n"; return 0; }
ABC151B - Achieve the Goal
#include <iostream> using namespace std; #define REP(i, n) for (int i = 0; i < (n); ++i) int main(void) { int n, k, m, a, sum = 0; cin.tie(0); ios::sync_with_stdio(false); cin >> n >> k >> m; REP(i, n - 1) { cin >> a; sum += a; } int ans = m * n - sum; if (k < ans) { ans = -1; } else if (ans < 0) { ans = 0; } cout << ans << "\n"; return 0; }