結果
| 問題 | 
                            No.1184 Hà Nội
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2020-09-05 17:19:23 | 
| 言語 | Rust  (1.83.0 + proconio)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 2 ms / 2,000 ms | 
| コード長 | 543 bytes | 
| コンパイル時間 | 13,182 ms | 
| コンパイル使用メモリ | 378,584 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-11-29 01:26:51 | 
| 合計ジャッジ時間 | 14,080 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge1 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 27 | 
ソースコード
const DIVISOR: u64 = 998244353;
fn power(base: u64, p: u64) -> u64 {
    if p == 0 { return 1; }
    if p == 1 { return base; }
    let temp = power(base, p / 2);
    temp % DIVISOR * temp % DIVISOR * power(base, p % 2) % DIVISOR
}
fn main() {
    let mut nl = String::new();
    std::io::stdin().read_line(&mut nl).ok();
    let nl: Vec<u64> = nl.trim().split_whitespace().map(|s| s.parse().unwrap()).collect();
    let n = nl[0] / nl[1] + if nl[0] % nl[1] > 0 { 1 } else { 0 };
    println!("{}", (power(2, n) + DIVISOR - 1) % DIVISOR);
}