結果

問題 No.2079 aaabbc
ユーザー phspls
提出日時 2022-12-21 23:39:31
言語 Rust
(1.83.0 + proconio)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 411 bytes
コンパイル時間 10,109 ms
コンパイル使用メモリ 388,032 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-11-18 03:10:37
合計ジャッジ時間 11,139 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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