結果
| 問題 | No.18 うーさー暗号 |
| コンテスト | |
| ユーザー |
🇳🇱🦭🇯🇵
|
| 提出日時 | 2024-09-04 11:06:07 |
| 言語 | Rust (1.83.0 + proconio) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 5,000 ms |
| コード長 | 666 bytes |
| コンパイル時間 | 12,646 ms |
| コンパイル使用メモリ | 402,584 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-09-04 11:06:22 |
| 合計ジャッジ時間 | 13,884 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 13 |
ソースコード
use std::io;
use std::io::prelude::*;
fn main() {
let stdin = io::read_to_string(io::stdin()).unwrap();
let mut stdin = stdin.split_whitespace();
let stdout = io::stdout();
let mut stdout = io::BufWriter::new(stdout.lock());
let s = stdin.next().unwrap();
let letters: Vec<char> = "ZYXWVUTSRQPONMLKJIHGFEDCBA".chars().collect();
let s: String = s
.chars()
.zip((1..=26).cycle())
.map(|(c, n)| {
let position = letters.iter().position(|&x| x == c).unwrap_or(0);
letters[(position + n) % letters.len()]
})
.collect();
writeln!(stdout, "{}", s).unwrap_or(());
}
🇳🇱🦭🇯🇵