結果

問題 No.1299 Random Array Score
コンテスト
ユーザー norioc
提出日時 2026-01-22 02:37:48
言語 Rust
(1.92.0 + proconio + num + itertools)
結果
WA  
実行時間 -
コード長 575 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 28,665 ms
コンパイル使用メモリ 416,952 KB
実行使用メモリ 7,852 KB
最終ジャッジ日時 2026-01-22 02:39:26
合計ジャッジ時間 29,985 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 3 WA * 31
権限があれば一括ダウンロードができます
コンパイルメッセージ
warning: unused import: `marker::Chars`
 --> src/main.rs:2:23
  |
2 | use proconio::{input, marker::Chars};
  |                       ^^^^^^^^^^^^^
  |
  = note: `#[warn(unused_imports)]` (part of `#[warn(unused)]`) on by default

ソースコード

diff #
raw source code

#![allow(non_snake_case)]
use proconio::{input, marker::Chars};

fn mod_pow(base: i64, exp: i64, modulus: i64) -> i64 {
    if exp == 0 { return 1 }
    if exp == 1 { return base % modulus }
    let x = mod_pow(base, exp / 2, modulus);
    if exp & 1 > 0 {
        ((x * base) % modulus) * x % modulus
    } else {
        x * x % modulus
    }
}

fn main() {
    input! {
        N: usize,
        K: i64,
        A: [i64; N],
    }

    const MOD: i64 = 998244353;
    let tot: i64 = A.iter().sum();
    let ans = tot * mod_pow(2, K, MOD) % MOD;
    println!("{}", ans);
}
0