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; }