結果

問題 No.1183 コイン遊び
ユーザー ixTL255ixTL255
提出日時 2023-02-19 22:42:20
言語 Rust
(1.77.0)
結果
AC  
実行時間 36 ms / 2,000 ms
コード長 678 bytes
コンパイル時間 3,845 ms
コンパイル使用メモリ 132,500 KB
実行使用メモリ 7,828 KB
最終ジャッジ日時 2023-09-28 01:45:48
合計ジャッジ時間 8,803 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 0 ms
4,376 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 3 ms
4,380 KB
testcase_12 AC 22 ms
5,684 KB
testcase_13 AC 21 ms
5,340 KB
testcase_14 AC 33 ms
7,444 KB
testcase_15 AC 34 ms
7,820 KB
testcase_16 AC 35 ms
7,808 KB
testcase_17 AC 34 ms
7,808 KB
testcase_18 AC 35 ms
7,808 KB
testcase_19 AC 36 ms
7,764 KB
testcase_20 AC 34 ms
7,824 KB
testcase_21 AC 30 ms
7,808 KB
testcase_22 AC 28 ms
7,768 KB
testcase_23 AC 30 ms
7,760 KB
testcase_24 AC 30 ms
7,812 KB
testcase_25 AC 36 ms
7,808 KB
testcase_26 AC 34 ms
7,808 KB
testcase_27 AC 35 ms
7,820 KB
testcase_28 AC 35 ms
7,796 KB
testcase_29 AC 30 ms
7,800 KB
testcase_30 AC 30 ms
7,732 KB
testcase_31 AC 36 ms
7,828 KB
testcase_32 AC 35 ms
7,796 KB
testcase_33 AC 35 ms
7,768 KB
testcase_34 AC 34 ms
7,752 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
warning: variable does not need to be mutable
 --> Main.rs:4:9
  |
4 |     let mut n: usize = n.trim().parse().unwrap();
  |         ----^
  |         |
  |         help: remove this `mut`
  |
  = note: `#[warn(unused_mut)]` on by default

warning: 1 warning emitted

ソースコード

diff #

fn main() {
    let mut n = String::new();
    std::io::stdin().read_line(&mut n).ok();
    let mut n: usize = n.trim().parse().unwrap();
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    let itr = s.trim().split_whitespace();
    let a: Vec<u8> = itr.map(|x| x.parse().unwrap()).collect();
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    let itr = s.trim().split_whitespace();
    let b: Vec<u8> = itr.map(|x| x.parse().unwrap()).collect();

    let mut ans = 0;
    if a[0] ^ b[0] == 1 { ans += 1; }
    for i in 1..n{
        if a[i] != b[i] && a[i - 1] == b[i - 1] { ans += 1; }
    }

    println!("{}", ans);
}
0