結果

問題 No.99 ジャンピング駒
ユーザー fkwnw3_1243fkwnw3_1243
提出日時 2017-04-27 21:48:53
言語 Java21
(openjdk 21)
結果
AC  
実行時間 226 ms / 5,000 ms
コード長 710 bytes
コンパイル時間 2,031 ms
コンパイル使用メモリ 72,848 KB
実行使用メモリ 61,160 KB
最終ジャッジ日時 2023-10-11 16:10:16
合計ジャッジ時間 4,580 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 215 ms
61,160 KB
testcase_01 AC 222 ms
59,696 KB
testcase_02 AC 220 ms
59,848 KB
testcase_03 AC 217 ms
60,080 KB
testcase_04 AC 215 ms
60,020 KB
testcase_05 AC 226 ms
59,872 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;


public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        int N = Integer.parseInt(reader.readLine());
        String[] inputs = reader.readLine().split(" ");
        int evenCounter = 0;
        int oddCounter = 0;

        for (int i = 0; i < N; i++) {
            if (Integer.parseInt(inputs[i]) % 2 == 0) {
                evenCounter += 1;
            } else {
                oddCounter += 1;
            }
        }

        System.out.println(Math.abs(evenCounter-oddCounter));
    }
}
0