結果

問題 No.99 ジャンピング駒
ユーザー mits58mits58
提出日時 2016-07-09 17:02:48
言語 Java21
(openjdk 21)
結果
AC  
実行時間 771 ms / 5,000 ms
コード長 314 bytes
コンパイル時間 2,482 ms
コンパイル使用メモリ 74,664 KB
実行使用メモリ 59,660 KB
最終ジャッジ日時 2024-04-21 10:45:10
合計ジャッジ時間 8,192 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 719 ms
59,360 KB
testcase_01 AC 689 ms
59,660 KB
testcase_02 AC 731 ms
59,120 KB
testcase_03 AC 771 ms
59,264 KB
testcase_04 AC 717 ms
59,656 KB
testcase_05 AC 692 ms
59,184 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

class Main{
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		while(sc.hasNext()){
			int n=sc.nextInt();
			int o=0,e=0;
			for(int i=0;i<n;i++){
				int x=sc.nextInt();
				if(x%2==0) e++;
				else o++;
			}
			System.out.println(Math.abs(o-e));
		}
	}
}
0