結果
| 問題 |
No.1455 拡張ROTN
|
| コンテスト | |
| ユーザー |
e869120
|
| 提出日時 | 2021-03-31 21:10:51 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 937 bytes |
| コンパイル時間 | 817 ms |
| コンパイル使用メモリ | 85,032 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-12-15 13:04:50 |
| 合計ジャッジ時間 | 1,631 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 22 |
ソースコード
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
using namespace std;
#pragma warning (disable: 4996)
string S;
long long N, rem;
string solve(string T) {
string U = "";
for (int i = 0; i < T.size(); i++) {
if (T[i] == '9') U += "CpCzNkSuTbEoA";
else if (T[i] == 'Z') U += "A";
else if (T[i] == 'z') U += "a";
else U += (T[i] + 1);
}
return U;
}
int main() {
cin >> S >> N;
rem = N;
for (int i = 0; i < min(10LL, N); i++) {
rem--;
S = solve(S);
}
for (int i = 0; i < S.size(); i++) {
if (S[i] >= 'A' && S[i] <= 'Z') {
long long nex = (S[i] - 'A');
nex = (nex + rem) % 26LL;
cout << (char)('A' + nex);
}
else if (S[i] >= '0' && S[i] <= '9') {
cout << S[i];
}
else {
long long nex = (S[i] - 'a');
nex = (nex + rem) % 26LL;
cout << (char)('a' + nex);
}
}
cout << endl;
return 0;
}
e869120