結果
| 問題 | No.18 うーさー暗号 | 
| コンテスト | |
| ユーザー |  f843nmfwisfeuw | 
| 提出日時 | 2020-07-01 09:38:09 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 2 ms / 5,000 ms | 
| コード長 | 582 bytes | 
| コンパイル時間 | 917 ms | 
| コンパイル使用メモリ | 92,680 KB | 
| 実行使用メモリ | 6,944 KB | 
| 最終ジャッジ日時 | 2024-09-13 20:53:03 | 
| 合計ジャッジ時間 | 1,525 ms | 
| ジャッジサーバーID (参考情報) | judge3 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 13 | 
ソースコード
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <stack>
#include <algorithm>
#include <string>
#include <map>
#include <iterator>
#include <set>
#include <queue>
using namespace std;
char solve(char c, int i) {
    int b = (c - 'A') - i;
    while (b < 0) {
        b += 26;
    }
    char res = (char) ('A' + b % 26);
    return res;
}
int main() {
    string S;
    cin >> S;
    string res;
    for (int i = 0; i < S.size(); ++i) {
        res += solve(S[i], i + 1);
    }
    cout << res << endl;
    return 0;
}
            
            
            
        