結果

問題 No.99 ジャンピング駒
ユーザー abcabc
提出日時 2016-11-03 15:31:05
言語 Java21
(openjdk 21)
結果
AC  
実行時間 673 ms / 5,000 ms
コード長 533 bytes
コンパイル時間 2,184 ms
コンパイル使用メモリ 74,100 KB
実行使用メモリ 48,036 KB
最終ジャッジ日時 2024-05-03 21:43:14
合計ジャッジ時間 7,253 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 660 ms
47,956 KB
testcase_01 AC 673 ms
47,964 KB
testcase_02 AC 560 ms
47,696 KB
testcase_03 AC 647 ms
48,036 KB
testcase_04 AC 652 ms
47,924 KB
testcase_05 AC 629 ms
47,796 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        int numPieces = sc.nextInt();

        int evenOddDifference = 0;

        for (int i = 0; i < numPieces; i++) {

            int coordinate = sc.nextInt();

            if (coordinate % 2 == 0) {
                evenOddDifference++;
            } else {
                evenOddDifference--;
            }

        }

        System.out.println(Math.abs(evenOddDifference));

    }

}
0