ABC147B - Palindrome-philia
#include <iostream> #include <string> using namespace std; #define REP(i, n) for (int i = 0; i < (n); ++i) int main(void) { int ans = 0; string s; cin.tie(0); ios::sync_with_stdio(false); cin >> s; REP(i, s.length() / 2) { if (i != s.length() - 1 - i && s[i] != s[s.length() - 1 - i]) { ans++; } } cout << ans << "\n"; return 0; }
ABC147A - Blackjack
#include <iostream> using namespace std; int main(void) { int a1, a2, a3; cin.tie(0); ios::sync_with_stdio(false); cin >> a1 >> a2 >> a3; cout << (a1 + a2 + a3 <= 21? "win" : "bust") << "\n"; return 0; }
ABC146B - ROT N
問題:B - ROT N
#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; cin.tie(0); ios::sync_with_stdio(false); cin >> n; cin >> s; REP(i, s.length()) { s[i] = (n + (s[i] - 'A')) % 26 + 'A'; } cout << s << "\n"; return 0; }
ABC146A - Can't Wait for Holiday
#include <algorithm> #include <iostream> #include <iterator> #include <string> #include <vector> using namespace std; #define ALL(c) (c).begin(), (c).end() int main(void) { const vector<string> WEEKDAY = {"SUN", "MON", "TUE", "WED" , "THU", "FRI", "SAT"}; string s; cin.tie(0); ios::sync_with_stdio(false); cin >> s; cout << 7 - distance(WEEKDAY.begin(), find(ALL(WEEKDAY), s)) << "\n"; return 0; }
ABC145B - Echo
問題:B - Echo
#include <iostream> #include <string> using namespace std; int main(void) { int n; string s; cin.tie(0); ios::sync_with_stdio(false); cin >> n; cin >> s; cout << (n % 2 == 0 && s.substr(0, n / 2) == s.substr(n / 2, n)? "Yes" : "No") << "\n"; return 0; }
ABC145A - Circle
問題:A - Circle
#include <iostream> using namespace std; int main(void) { int r; cin.tie(0); ios::sync_with_stdio(false); cin >> r; cout << r * r << "\n"; return 0; }
ABC144B - 81
問題:B - 81
#include <iostream> using namespace std; #define FOR(i, a, b) for (int i = (a); i < (b); ++i) int main(void) { int n; bool flg = false; cin.tie(0); ios::sync_with_stdio(false); cin >> n; FOR(i, 1, 9 + 1) { FOR(j, 1, 9 + 1) { if (i * j == n) { flg = true; } } } cout << (flg? "Yes" : "No") << "\n"; return 0; }