結果

問題 No.99 ジャンピング駒
ユーザー Grenache
提出日時 2015-09-23 19:51:19
言語 Java
(openjdk 23)
結果
AC  
実行時間 632 ms / 5,000 ms
コード長 483 bytes
コンパイル時間 3,019 ms
コンパイル使用メモリ 74,712 KB
実行使用メモリ 48,188 KB
最終ジャッジ日時 2024-07-19 08:49:35
合計ジャッジ時間 7,652 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 6
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;


public class Main_yukicoder99 {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int odd = 0;
        int even = 0;
        for (int i = 0; i < n; i++) {
        	int x = sc.nextInt();
        	if (x % 2 == 0) {
        		even++;
        	} else {
        		odd++;
        	}
        }

        System.out.println(Math.abs(even - odd));
        
        sc.close();
    }
}
0