結果

問題 No.495 (^^*) Easy
ユーザー hebiyanhebiyan
提出日時 2017-05-18 01:34:49
言語 Rust
(1.77.0)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 506 bytes
コンパイル時間 1,422 ms
コンパイル使用メモリ 163,132 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-18 00:02:26
合計ジャッジ時間 983 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

warning: 1 warning emitted

ソースコード

diff #

use std::str;

fn getline() -> String {
    let mut rv = String::new();

    std::io::stdin().read_line(&mut rv).ok();

    return rv;
}

fn main() {
    let s = getline();

    let mut l = 0u32;
    let mut r = 0u32;
    for p in s.into_bytes().chunks(5) {
        if char::from(p[0]) == '#' {
            break
        }
        else if char::from(p[3]) == '*' {
            l += 1;
        }
        else if char::from(p[3]) == '^' {
            r += 1;
        }
    }

    println!("{} {}", l, r);
}
0