結果
| 問題 | No.933 おまわりさんこいつです |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-01-25 21:47:59 |
| 言語 | Rust (1.83.0 + proconio) |
| 結果 |
AC
|
| 実行時間 | 11 ms / 2,000 ms |
| コード長 | 741 bytes |
| 記録 | |
| コンパイル時間 | 12,670 ms |
| コンパイル使用メモリ | 377,972 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-09-14 04:15:04 |
| 合計ジャッジ時間 | 13,969 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 25 |
コンパイルメッセージ
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: u128 = 1;
all_data.iter().skip(1).next().unwrap().split_whitespace()
.map(|a| a.parse::<u128>().unwrap())
.map(|a| if a == 0 { 0 } else if a % 9 == 0 { 9 } else { a % 9 })
.for_each(|a| {
result = if result * a == 0 { 0 } else if (result * a) % 9 == 0 { 9 } else { (result * a) % 9 };
});
println!("{}", if result == 0 { 0 } else if result % 9 == 0 { 9 } else { result % 9 });
}