結果

問題 No.18 うーさー暗号
ユーザー VangaroooYamadaVangaroooYamada
提出日時 2021-09-06 13:56:06
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 422 bytes
コンパイル時間 634 ms
コンパイル使用メモリ 68,664 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-12-22 19:16:15
合計ジャッジ時間 1,421 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <cmath>
using namespace std;

char decorder(char c, int shift) {
    int num_of_A = 'A';
    
    while (c - fmod(shift, 26) < num_of_A) {
        shift -= 26;
    }
    
    return c - fmod(shift, 26);
}

int main() {
    string uhsah;
    cin >> uhsah;
    
    for (int c=0; c < uhsah.size(); ++c) {
        cout << decorder(uhsah[c], c+1);
    }
    
    cout << endl;
}
0