結果

問題 No.99 ジャンピング駒
ユーザー htensaihtensai
提出日時 2019-12-05 18:08:39
言語 Java21
(openjdk 21)
結果
AC  
実行時間 628 ms / 5,000 ms
コード長 349 bytes
コンパイル時間 2,420 ms
コンパイル使用メモリ 72,620 KB
実行使用メモリ 61,060 KB
最終ジャッジ日時 2023-08-23 10:46:17
合計ジャッジ時間 7,611 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 618 ms
61,060 KB
testcase_01 AC 616 ms
60,292 KB
testcase_02 AC 628 ms
60,944 KB
testcase_03 AC 594 ms
60,204 KB
testcase_04 AC 590 ms
60,692 KB
testcase_05 AC 594 ms
61,016 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

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

0