結果

問題 No.18 うーさー暗号
コンテスト
ユーザー rustGanbaruman
提出日時 2026-02-10 12:24:39
言語 Rust
(1.92.0 + proconio + num + itertools)
結果
AC  
実行時間 1 ms / 5,000 ms
コード長 455 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,258 ms
コンパイル使用メモリ 201,800 KB
実行使用メモリ 7,972 KB
最終ジャッジ日時 2026-02-10 12:24:42
合計ジャッジ時間 2,790 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

use proconio::input;

fn main() {
    input! {
      mut sentence:String
    }
    sentence = sentence.to_lowercase();
    let mut output: Vec<char> = vec![];

    for (i, c) in sentence.bytes().enumerate() {
        let result: i32 = (c as i32 - b'a' as i32 - (i as i32 + 1)).rem_euclid(26) + b'a' as i32;
        output.push(result as u8 as char);
    }

    println!("{}",output.iter().map(|x|x.to_string().to_uppercase()).collect::<String>()
    );
}
0