結果
| 問題 |
No.1455 拡張ROTN
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-07-22 18:05:23 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 1,293 bytes |
| コンパイル時間 | 973 ms |
| コンパイル使用メモリ | 114,660 KB |
| 最終ジャッジ日時 | 2025-01-23 05:55:14 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 22 |
ソースコード
#include <algorithm>
#include <array>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <optional>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
int main() {
string s;
int64_t n;
cin >> s >> n;
while (n > 0) {
string next_s;
bool found = false;
for (auto c : s) {
if ('a' <= c && c <= 'z')
next_s.push_back((c - 'a' + 1) % 26 + 'a');
else if ('A' <= c && c <= 'Z')
next_s.push_back((c - 'A' + 1) % 26 + 'A');
else if ('0' <= c && c <= '8') {
found = true;
next_s.push_back(c + 1);
} else {
found = true;
next_s += "CpCzNkSuTbEoA";
}
}
--n;
s = next_s;
if (!found)
break;
}
for (auto c : s) {
char ans;
if ('a' <= c && c <= 'z')
ans = (c - 'a' + n % 26) % 26 + 'a';
else if ('A' <= c && c <= 'Z')
ans = (c - 'A' + n % 26) % 26 + 'A';
else
ans = c;
cout << char(ans);
}
cout << endl;
return 0;
}