結果
問題 | No.1299 Random Array Score |
ユーザー | uw_yu1rabbit |
提出日時 | 2020-12-11 17:54:19 |
言語 | Rust (1.77.0 + proconio) |
結果 |
WA
|
実行時間 | - |
コード長 | 959 bytes |
コンパイル時間 | 11,684 ms |
コンパイル使用メモリ | 404,128 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-09-19 21:25:47 |
合計ジャッジ時間 | 12,916 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
5,248 KB |
testcase_01 | AC | 1 ms
5,248 KB |
testcase_02 | AC | 1 ms
5,248 KB |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | WA | - |
testcase_24 | WA | - |
testcase_25 | WA | - |
testcase_26 | WA | - |
testcase_27 | WA | - |
testcase_28 | WA | - |
testcase_29 | WA | - |
testcase_30 | WA | - |
testcase_31 | WA | - |
testcase_32 | WA | - |
testcase_33 | WA | - |
testcase_34 | AC | 14 ms
5,376 KB |
testcase_35 | AC | 22 ms
5,376 KB |
testcase_36 | AC | 14 ms
5,376 KB |
コンパイルメッセージ
warning: unused import: `std::collections::*` --> src/main.rs:4:5 | 4 | use std::collections::*; | ^^^^^^^^^^^^^^^^^^^ | = note: `#[warn(unused_imports)]` on by default warning: variable does not need to be mutable --> src/main.rs:23:9 | 23 | let mut k:u64 = read(); | ----^ | | | help: remove this `mut` | = note: `#[warn(unused_mut)]` on by default warning: variable does not need to be mutable --> src/main.rs:24:9 | 24 | let mut a:Vec<u64> = (0..n).map(|_| read()).collect(); | ----^ | | | help: remove this `mut` warning: variable does not need to be mutable --> src/main.rs:25:9 | 25 | let mut f:u64 = a.into_iter().sum(); | ----^ | | | help: remove this `mut` warning: constant `Mod` should have an upper case name --> src/main.rs:20:7 | 20 | const Mod:u64 = 998244353; | ^^^ help: convert the identifier to upper case: `MOD` | = note: `#[warn(non_upper_case_globals)]` on by default
ソースコード
#[allow(unused_imports)] //use proconio::*; use std::cmp::*; use std::collections::*; use std::io::*; use std::iter::*; use std::str::FromStr; fn read<T: FromStr>() -> T { let stdin = stdin(); let stdin = stdin.lock(); let token: String = stdin .bytes() .map(|c| c.expect("failed to read char") as char) .skip_while(|c| c.is_whitespace()) .take_while(|c| !c.is_whitespace()) .collect(); token.parse().ok().expect("failed to parse token") } const Mod:u64 = 998244353; fn main() { let n:usize = read(); let mut k:u64 = read(); let mut a:Vec<u64> = (0..n).map(|_| read()).collect(); let mut f:u64 = a.into_iter().sum(); println!("{}",(rep_mul(2u64,k) * f) % Mod); } fn rep_mul(mut x: u64, mut n: u64) -> u64{ let mut ans:u64 = 1; while n > 0{ if n % 2 == 1 { ans = x * ans % Mod; } x = x * x % Mod; n = n >> 1u64; } ans }