結果
| 問題 |
No.933 おまわりさんこいつです
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-01-25 21:19:32 |
| 言語 | Rust (1.83.0 + proconio) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 592 bytes |
| コンパイル時間 | 13,282 ms |
| コンパイル使用メモリ | 402,056 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-09-14 04:14:16 |
| 合計ジャッジ時間 | 14,026 ms |
|
ジャッジサーバーID (参考情報) |
judge6 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 22 WA * 3 |
コンパイルメッセージ
warning: unused variable: `n` --> src/main.rs:7:9 | 7 | let n: u128 = all_data.iter().next().unwrap().parse::<u128>().unwrap(); | ^ help: if this is intentional, prefix it with an underscore: `_n` | = note: `#[warn(unused_variables)]` on by default
ソースコード
use std::io::Read;
fn main() {
let mut all_data = String::new();
std::io::stdin().read_to_string(&mut all_data).ok();
let all_data: Vec<&str> = all_data.trim().split('\n').map(|a| a.trim()).collect();
let n: u128 = all_data.iter().next().unwrap().parse::<u128>().unwrap();
let mut result = 1;
all_data.iter().skip(1).next().unwrap().split_whitespace()
.map(|a| a.parse::<u128>().unwrap() % 9)
.map(|a| if a == 0 { 9 } else { a })
.for_each(|a| {result = (result * a) % 9;});
println!("{}", if result % 9 == 0 { 9 } else { result % 9 });
}