結果

問題 No.99 ジャンピング駒
ユーザー hanorverhanorver
提出日時 2015-09-01 22:42:39
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 41 ms / 5,000 ms
コード長 301 bytes
コンパイル時間 485 ms
コンパイル使用メモリ 51,280 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-25 21:49:01
合計ジャッジ時間 1,346 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
4,384 KB
testcase_01 AC 41 ms
4,380 KB
testcase_02 AC 41 ms
4,380 KB
testcase_03 AC 41 ms
4,376 KB
testcase_04 AC 41 ms
4,380 KB
testcase_05 AC 41 ms
4,384 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>

int main() {
	int n;
	std::cin >> n;

	//[0]=odd, [1]=even;
	int odd_or_even[2] = { 0 };
	for (int i = 0; i < n; i++) {
		long long num;
		std::cin >> num;
		num = abs(num);
		odd_or_even[num % 2]++;
	}

	std::cout << abs(odd_or_even[0] - odd_or_even[1]) << std::endl;
	return 0;
}
0