結果

問題 No.99 ジャンピング駒
ユーザー abc
提出日時 2016-11-03 15:31:05
言語 Java
(openjdk 23)
結果
AC  
実行時間 621 ms / 5,000 ms
コード長 533 bytes
コンパイル時間 2,640 ms
コンパイル使用メモリ 74,284 KB
実行使用メモリ 59,580 KB
最終ジャッジ日時 2024-11-25 02:25:28
合計ジャッジ時間 7,513 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 6
権限があれば一括ダウンロードができます

ソースコード

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