結果
問題 | No.1455 拡張ROTN |
ユーザー |
|
提出日時 | 2021-03-31 21:23:56 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 4 ms / 2,000 ms |
コード長 | 927 bytes |
コンパイル時間 | 834 ms |
コンパイル使用メモリ | 69,376 KB |
最終ジャッジ日時 | 2025-01-20 02:51:17 |
ジャッジサーバーID (参考情報) |
judge2 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 22 |
ソースコード
#line 1 "main.cpp" #include <iostream> #include <string> using namespace std; using lint = long long; string f(const string& s) { string t; for (auto c : s) { if (islower(c)) { t.push_back((c - 'a' + 1) % 26 + 'a'); } else if (isupper(c)) { t.push_back((c - 'A' + 1) % 26 + 'A'); } else { if (c < '9') { t.push_back(c + 1); } else { t += "CpCzNkSuTbEoA"; } } } return t; } void solve() { string s; lint n; cin >> s >> n; for (int t = 0; t < 10 && n > 0; ++t, --n) s = f(s); for (auto& c : s) { if (islower(c)) { c = (c - 'a' + n) % 26 + 'a'; } else { c = (c - 'A' + n) % 26 + 'A'; } } cout << s << "\n"; } int main() { cin.tie(nullptr); ios::sync_with_stdio(false); solve(); return 0; }