結果

問題 No.99 ジャンピング駒
ユーザー nCk_cvnCk_cv
提出日時 2016-01-29 16:55:24
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 448 bytes
コンパイル時間 2,300 ms
コンパイル使用メモリ 75,128 KB
実行使用メモリ 62,420 KB
最終ジャッジ日時 2023-10-21 16:36:07
合計ジャッジ時間 7,674 ms
ジャッジサーバーID
(参考情報)
judge10 / judge9
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 689 ms
62,100 KB
testcase_01 AC 701 ms
62,420 KB
testcase_02 AC 683 ms
62,184 KB
testcase_03 AC 664 ms
62,400 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;
		ArrayList<Integer> list = new ArrayList<Integer>();
		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(Math.abs(a- b));
		}
	}
}
0