結果

問題 No.2079 aaabbc
ユーザー phspls
提出日時 2023-01-18 03:40:43
言語 Rust
(1.83.0 + proconio)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 411 bytes
コンパイル時間 25,445 ms
コンパイル使用メモリ 400,200 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-11 07:24:04
合計ジャッジ時間 17,883 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 5
other AC * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

const MOD: usize = 998244353;

fn power(base: usize, times: usize) -> usize {
    if times == 0 { return 1usize; }
    if times == 1 { return base; }
    let temp = power(base, times/2);
    temp * temp % MOD * power(base, times%2) % MOD
}

fn main() {
    let mut n = String::new();
    std::io::stdin().read_line(&mut n).ok();
    let n: usize = n.trim().parse().unwrap();

    println!("{}", power(3, n));
}
0