結果

問題 No.99 ジャンピング駒
ユーザー tentententen
提出日時 2020-12-07 14:11:02
言語 Java19
(openjdk 21)
結果
AC  
実行時間 609 ms / 5,000 ms
コード長 423 bytes
コンパイル時間 1,946 ms
コンパイル使用メモリ 74,556 KB
実行使用メモリ 62,488 KB
最終ジャッジ日時 2023-10-17 16:29:19
合計ジャッジ時間 7,003 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 556 ms
62,488 KB
testcase_01 AC 609 ms
62,192 KB
testcase_02 AC 601 ms
62,140 KB
testcase_03 AC 586 ms
62,072 KB
testcase_04 AC 582 ms
62,420 KB
testcase_05 AC 573 ms
62,464 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