結果

問題 No.933 おまわりさんこいつです
ユーザー phsplsphspls
提出日時 2020-01-25 17:36:35
言語 Rust
(1.77.0)
結果
WA  
実行時間 -
コード長 590 bytes
コンパイル時間 638 ms
コンパイル使用メモリ 149,320 KB
実行使用メモリ 4,476 KB
最終ジャッジ日時 2023-10-12 04:39:17
合計ジャッジ時間 1,803 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 0 ms
4,352 KB
testcase_01 AC 0 ms
4,352 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 1 ms
4,352 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 1 ms
4,352 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 1 ms
4,348 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 1 ms
4,348 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 9 ms
4,348 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
warning: unused variable: `n`
 --> Main.rs:7:9
  |
7 |     let n: usize = all_data.iter().next().unwrap().parse::<usize>().unwrap();
  |         ^ help: if this is intentional, prefix it with an underscore: `_n`
  |
  = note: `#[warn(unused_variables)]` on by default

warning: 1 warning emitted

ソースコード

diff #

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: usize = all_data.iter().next().unwrap().parse::<usize>().unwrap();
    let mut p: u128 = all_data.iter().skip(1).next().unwrap().split_whitespace().map(|a| a.parse::<u128>().unwrap()).sum();
    while p >= 10 {
        let p_str: String = p.to_string();
        p = p_str.chars().map(|a| a.to_string().parse::<u128>().unwrap()).sum();
    }
    println!("{}", p);
}
0