結果

問題 No.99 ジャンピング駒
ユーザー kou6839kou6839
提出日時 2014-12-12 16:08:35
言語 Java21
(openjdk 21)
結果
AC  
実行時間 623 ms / 5,000 ms
コード長 425 bytes
コンパイル時間 2,194 ms
コンパイル使用メモリ 71,756 KB
実行使用メモリ 60,780 KB
最終ジャッジ日時 2023-09-02 14:23:02
合計ジャッジ時間 7,165 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 604 ms
60,648 KB
testcase_01 AC 623 ms
60,756 KB
testcase_02 AC 609 ms
60,780 KB
testcase_03 AC 603 ms
60,452 KB
testcase_04 AC 586 ms
60,220 KB
testcase_05 AC 599 ms
60,780 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.math.*;
import java.util.*;
 
public class Main {
    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 temp = sc.nextInt();
        	if(temp%2==0) even++;
        	else odd++;
        }
        System.out.println(n-Math.min(odd,even)*2);
    }
}	
0