結果

問題 No.99 ジャンピング駒
ユーザー nCk_cvnCk_cv
提出日時 2016-01-29 16:07:37
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 400 bytes
コンパイル時間 2,079 ms
コンパイル使用メモリ 74,148 KB
実行使用メモリ 62,532 KB
最終ジャッジ日時 2023-10-21 16:35:30
合計ジャッジ時間 7,335 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 616 ms
62,368 KB
testcase_01 AC 614 ms
62,444 KB
testcase_02 AC 619 ms
62,484 KB
testcase_03 AC 607 ms
62,196 KB
testcase_04 WA -
testcase_05 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.math.*;
import java.io.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int a = 0;
		int b = 0;
		for(int i = 0; i < N; i++) {
			if(sc.nextInt() % 2 == 0) a++;
			else b++;
		}
		if(a == 0 || b == 0) System.out.println(0);
		else {
			System.out.println(N - Math.min(a, b)*2);
		}
	}
}
0