結果
| 問題 |
No.99 ジャンピング駒
|
| コンテスト | |
| ユーザー |
nak3
|
| 提出日時 | 2017-11-22 21:19:32 |
| 言語 | Rust (1.83.0 + proconio) |
| 結果 |
AC
|
| 実行時間 | 37 ms / 5,000 ms |
| コード長 | 641 bytes |
| コンパイル時間 | 12,082 ms |
| コンパイル使用メモリ | 400,492 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-26 11:23:50 |
| 合計ジャッジ時間 | 13,196 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 6 |
ソースコード
use std::io::*;
use std::str::*;
fn read<T: FromStr>() -> Option<T> {
let stdin = stdin();
let s = stdin
.bytes()
.map(|c| c.unwrap() as char)
.take_while(|c| !c.is_whitespace())
.collect::<String>();
s.parse::<T>().ok()
}
fn main() {
let n: u64 = read().unwrap();
let mut o = 0;
let mut e = 0;
for _ in 0..n {
let tmp: i64 = read().unwrap();
if tmp % 2 == 0 {
e = e + 1;
} else {
o = o + 1;
}
}
let ans = e - o;
if ans < 0 {
println!("{}", ans * (-1));
return;
}
println!("{}", ans);
}
nak3