結果
問題 | No.656 ゴルフ |
ユーザー |
![]() |
提出日時 | 2018-04-18 11:21:35 |
言語 | Rust (1.83.0 + proconio) |
結果 |
AC
|
実行時間 | 1 ms / 2,000 ms |
コード長 | 524 bytes |
コンパイル時間 | 24,933 ms |
コンパイル使用メモリ | 387,712 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-27 04:28:49 |
合計ジャッジ時間 | 16,739 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 6 |
コンパイルメッセージ
warning: unused import: `std::str::*` --> src/main.rs:2:5 | 2 | use std::str::*; | ^^^^^^^^^^^ | = note: `#[warn(unused_imports)]` on by default warning: unnecessary parentheses around function argument --> src/main.rs:9:15 | 9 | return Ok((buf)); | ^ ^ | = note: `#[warn(unused_parens)]` on by default help: remove these parentheses | 9 - return Ok((buf)); 9 + return Ok(buf); | warning: unused variable: `x` --> src/main.rs:7:9 | 7 | let x = stdin().read_line(&mut buf)?; | ^ help: if this is intentional, prefix it with an underscore: `_x` | = note: `#[warn(unused_variables)]` on by default
ソースコード
use std::io::*; use std::str::*; fn read_line()->Result<String>{ let mut buf = String::new(); let x = stdin().read_line(&mut buf)?; return Ok((buf)); } fn main() { let mut holes = String::new(); holes += read_line().unwrap().trim(); let mut sum:i32 = 0; for i in holes.chars(){ let x = i.to_string(); let tmp = x.parse::<i32>().unwrap(); if tmp == 0{ sum += 10; } else { sum += tmp; } } println!("{}", sum); }