結果

問題 No.99 ジャンピング駒
ユーザー TatsuDXTatsuDX
提出日時 2016-09-08 23:46:53
言語 Java21
(openjdk 21)
結果
AC  
実行時間 609 ms / 5,000 ms
コード長 315 bytes
コンパイル時間 3,397 ms
コンパイル使用メモリ 76,272 KB
実行使用メモリ 59,332 KB
最終ジャッジ日時 2024-04-27 18:08:30
合計ジャッジ時間 7,323 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 544 ms
59,000 KB
testcase_01 AC 609 ms
59,248 KB
testcase_02 AC 542 ms
59,156 KB
testcase_03 AC 587 ms
59,280 KB
testcase_04 AC 592 ms
59,332 KB
testcase_05 AC 528 ms
58,976 KB
権限があれば一括ダウンロードができます

ソースコード

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