結果
| 問題 |
No.1183 コイン遊び
|
| コンテスト | |
| ユーザー |
ixTL255
|
| 提出日時 | 2023-02-19 22:42:20 |
| 言語 | Rust (1.83.0 + proconio) |
| 結果 |
AC
|
| 実行時間 | 65 ms / 2,000 ms |
| コード長 | 678 bytes |
| コンパイル時間 | 14,288 ms |
| コンパイル使用メモリ | 377,876 KB |
| 実行使用メモリ | 7,936 KB |
| 最終ジャッジ日時 | 2024-07-20 20:22:30 |
| 合計ジャッジ時間 | 19,038 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 32 |
コンパイルメッセージ
warning: variable does not need to be mutable --> src/main.rs:4:9 | 4 | let mut n: usize = n.trim().parse().unwrap(); | ----^ | | | help: remove this `mut` | = note: `#[warn(unused_mut)]` on by default
ソースコード
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);
}
ixTL255