結果
| 問題 |
No.18 うーさー暗号
|
| コンテスト | |
| ユーザー |
pro_kuni
|
| 提出日時 | 2018-06-16 21:20:54 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 508 bytes |
| コンパイル時間 | 413 ms |
| コンパイル使用メモリ | 55,240 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-30 16:26:15 |
| 合計ジャッジ時間 | 1,017 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 13 |
ソースコード
#include <iostream>
using namespace std;
char decrypt(char c, int i) {
char a;
int offset;
if ('a' <= c && c <= 'z') {
a = 'a';
} else {
a = 'A';
}
offset = c - a;
offset -= i;
while (true) {
if (offset >= 0) {
return (char)(offset + a);
}
offset += 26;
}
}
int main() {
string s;
cin >> s;
for (int i = 0; i < s.size(); i++) {
s[i] = decrypt(s[i], i+1);
}
cout << s;
return 0;
}
pro_kuni