結果

問題 No.99 ジャンピング駒
ユーザー hayaDhayaD
提出日時 2016-05-01 05:59:49
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 46 ms / 5,000 ms
コード長 465 bytes
コンパイル時間 565 ms
コンパイル使用メモリ 70,632 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-15 08:15:56
合計ジャッジ時間 1,435 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 44 ms
6,812 KB
testcase_01 AC 45 ms
6,940 KB
testcase_02 AC 44 ms
6,940 KB
testcase_03 AC 43 ms
6,944 KB
testcase_04 AC 46 ms
6,940 KB
testcase_05 AC 44 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <cmath>
using namespace std;

int main() {
	int N;
	cin >> N;
	int odd = 0;
	int even = 0;
	for (int i=0;i < N;i++){
		int t;
		cin >> t;
		if (t%2 == 0){
			even++;
		}else{
			odd++;
		}
	}
	int ans;
	if (even - odd >= 0){
		ans = even - odd;
	}else{
		ans = odd - even;
	}
	cout << ans << endl;
	return 0;
}
0