結果

問題 No.1232 2^x = x
ユーザー phspls
提出日時 2022-12-09 23:48:05
言語 Rust
(1.83.0 + proconio)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 533 bytes
コンパイル時間 14,571 ms
コンパイル使用メモリ 378,008 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-14 23:11:22
合計ジャッジ時間 15,812 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

fn main() {
    let mut n = String::new();
    std::io::stdin().read_line(&mut n).ok();
    let n: usize = n.trim().parse().unwrap();
    let p = (0..n).map(|_| {
            let mut temp = String::new();
            std::io::stdin().read_line(&mut temp).ok();
            let temp: usize = temp.trim().parse().unwrap();
            temp
        })
        .collect::<Vec<usize>>();

    for &v in p.iter() {
        if v == 2 {
            println!("2");
        } else {
            println!("{}", (v-1).pow(2));
        }
    }
}
0