結果

問題 No.99 ジャンピング駒
ユーザー spaciaspacia
提出日時 2016-01-02 08:57:18
言語 Java21
(openjdk 21)
結果
AC  
実行時間 248 ms / 5,000 ms
コード長 548 bytes
コンパイル時間 3,736 ms
コンパイル使用メモリ 74,968 KB
実行使用メモリ 63,660 KB
最終ジャッジ日時 2023-10-19 13:30:10
合計ジャッジ時間 4,507 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 241 ms
63,036 KB
testcase_01 AC 247 ms
63,292 KB
testcase_02 AC 237 ms
63,292 KB
testcase_03 AC 248 ms
63,036 KB
testcase_04 AC 238 ms
63,660 KB
testcase_05 AC 242 ms
63,164 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.*;

class Main99 {
	
	public static void out (Object o) {
		System.out.println(o);
	}
		
	public static void main (String[] args) throws IOException {
		BufferedReader br = 
			new BufferedReader(new InputStreamReader(System.in));
		
		int cnt1 = 0 , cnt2 = 0;
		int n = Integer.parseInt(br.readLine());
		String[] line = br.readLine().split(" ");
		
		for (int i = 0; i < n; i++) {
			int m = Integer.parseInt(line[i]);
			if (m % 2 == 0)
				cnt1++;
			else
				cnt2++;
		}
		
		out(Math.abs(cnt1 - cnt2));
	}
}
0