結果

問題 No.99 ジャンピング駒
ユーザー TatsuDX
提出日時 2016-09-08 23:46:53
言語 Java
(openjdk 23)
結果
AC  
実行時間 622 ms / 5,000 ms
コード長 315 bytes
コンパイル時間 3,665 ms
コンパイル使用メモリ 74,976 KB
実行使用メモリ 59,600 KB
最終ジャッジ日時 2024-11-15 22:30:02
合計ジャッジ時間 7,928 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 6
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

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

		int n = sc.nextInt(), a=0;
		for(int i = 0; i < n; i++){
			if(sc.nextInt() % 2 == 0){
				a++;
			} else {
				a--;
			}
		}
		if(a < 0){
			a *= -1;
		}
		System.out.println(a);
	}
}
0