結果

問題 No.656 ゴルフ
ユーザー hitoyozakehitoyozake
提出日時 2018-04-18 11:21:35
言語 Rust
(1.77.0)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 524 bytes
コンパイル時間 2,632 ms
コンパイル使用メモリ 143,784 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-09 11:21:14
合計ジャッジ時間 3,827 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 1 ms
4,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
warning: unused import: `std::str::*`
 --> Main.rs:2:5
  |
2 | use std::str::*;
  |     ^^^^^^^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default

warning: unnecessary parentheses around function argument
 --> 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`
 --> 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

warning: 3 warnings emitted

ソースコード

diff #

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);
}
0