結果
問題 |
No.1343 Dividing Digit
|
ユーザー |
![]() |
提出日時 | 2021-01-24 11:48:16 |
言語 | Rust (1.83.0 + proconio) |
結果 |
WA
|
実行時間 | - |
コード長 | 589 bytes |
コンパイル時間 | 13,786 ms |
コンパイル使用メモリ | 384,768 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2025-01-02 15:11:06 |
合計ジャッジ時間 | 16,095 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | WA * 22 |
コンパイルメッセージ
warning: unused variable: `n` --> src/main.rs:3:10 | 3 | let (n, k) = (v[0], v[1] as i64); | ^ help: if this is intentional, prefix it with an underscore: `_n` | = note: `#[warn(unused_variables)]` on by default
ソースコード
fn main() { let v = read_vec::<usize>(); let (n, k) = (v[0], v[1] as i64); let a = read_vec::<i64>(); let sum_a = a.iter().sum::<i64>(); let mut ans = 0; for anum in a { ans *= k; ans += anum; } println!("{}", ans % sum_a); } fn read<T: std::str::FromStr>() -> T { let mut s = String::new(); std::io::stdin().read_line(&mut s).ok(); s.trim().parse().ok().unwrap() } fn read_vec<T: std::str::FromStr>() -> Vec<T> { read::<String>() .split_whitespace() .map(|e| e.parse().ok().unwrap()) .collect() }