ABC151A - Next Alphabet
#include <iostream> using namespace std; int main(void) { char c; cin.tie(0); ios::sync_with_stdio(false); cin >> c; cout << (char)(c + 1) << "\n"; return 0; }
ABC150B - Count ABC
#include <iostream> #include <string> using namespace std; int main(void) { int n, pos = 0, ans = 0; string s; cin.tie(0); ios::sync_with_stdio(false); cin >> n; cin >> s; while (s.find("ABC", pos) != string::npos) { ans++; pos = s.find("ABC", pos) + 3; } cout << ans << "\n"; return 0; }
pos の位置をfind内に書いており、1WA。。
ABC150A - 500 Yen Coins
#include <iostream> using namespace std; int main(void) { int k, x; cin.tie(0); ios::sync_with_stdio(false); cin >> k >> x; cout << (x <= k * 500? "Yes" : "No") << "\n"; return 0; }
ABC149B - Greedy Takahashi
#include <iostream> using namespace std; int main(void) { long long a, b, k; cin.tie(0); ios::sync_with_stdio(false); cin >> a >> b >> k; a -= k; if (a < 0) { b += a; if (b < 0) { b = 0; } a = 0; } cout << a << " " << b << "\n"; return 0; }
ABC149A - Strings
問題:A - Strings
#include <iostream> #include <string> using namespace std; int main(void) { string s, t; cin.tie(0); ios::sync_with_stdio(false); cin >> s >> t; cout << t + s << "\n"; return 0; }
ABC148B - Strings with the Same Length
問題:B - Strings with the Same Length
#include <iostream> #include <string> using namespace std; #define REP(i, n) for (int i = 0; i < (n); ++i) int main(void) { int n; string s, t; cin.tie(0); ios::sync_with_stdio(false); cin >> n; cin >> s >> t; REP(i, n) { cout << s[i] << t[i]; } cout << "\n"; return 0; }
ABC148A - Round One
#include <iostream> using namespace std; int main(void) { int a, b; cin.tie(0); ios::sync_with_stdio(false); cin >> a >> b; cout << 6 - a - b << "\n"; return 0; }