結果

問題 No.18 うーさー暗号
ユーザー cleaskycleasky
提出日時 2024-02-03 22:54:06
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 372 bytes
コンパイル時間 2,685 ms
コンパイル使用メモリ 244,668 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-09-28 11:04:34
合計ジャッジ時間 3,399 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

char encrypt(char c, int n)
{
    char ret;
    ret = c - n % 26;
    if (ret < 'A') {
        ret += 'Z' - 'A' + 1;
    }
    return ret;
}

int main()
{
    cin.tie(0)->sync_with_stdio(0);

    string s;
    cin >> s;
    for (int i = 0; i < s.size(); i++) {
        cout << encrypt(s[i], i + 1);
    }
    cout << endl;
}
0