結果
| 問題 |
No.1455 拡張ROTN
|
| コンテスト | |
| ユーザー |
QCFium
|
| 提出日時 | 2021-03-31 21:20:13 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 660 bytes |
| コンパイル時間 | 2,041 ms |
| コンパイル使用メモリ | 168,928 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-12-15 14:18:10 |
| 合計ジャッジ時間 | 2,507 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 22 |
ソースコード
#include <bits/stdc++.h>
int ri() {
int n;
scanf("%d", &n);
return n;
}
int main() {
std::string s;
std::cin >> s;
int64_t n;
std::cin >> n;
std::string res;
for (auto i : s) {
if (isupper(i)) {
res.push_back((i - 'A' + n) % 26 + 'A');
} else if (islower(i)) {
res.push_back((i - 'a' + n) % 26 + 'a');
} else if (i - '0' + n >= 10) {
int64_t left = n - (10 - (i - '0'));
std::string tmp = "CpCzNkSuTbEoA";
for (auto &j : tmp) {
if (isupper(j)) j = (j - 'A' + left) % 26 + 'A';
else j = (j - 'a' + left) % 26 + 'a';
}
res += tmp;
} else res.push_back(i + n);
}
std::cout << res << std::endl;
return 0;
}
QCFium