結果
問題 | No.99 ジャンピング駒 |
ユーザー | koukonko |
提出日時 | 2015-12-11 17:50:21 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 216 ms / 5,000 ms |
コード長 | 759 bytes |
コンパイル時間 | 1,975 ms |
コンパイル使用メモリ | 72,444 KB |
実行使用メモリ | 61,388 KB |
最終ジャッジ日時 | 2023-10-13 10:57:43 |
合計ジャッジ時間 | 4,475 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 210 ms
60,504 KB |
testcase_01 | AC | 208 ms
59,940 KB |
testcase_02 | AC | 214 ms
61,388 KB |
testcase_03 | AC | 216 ms
60,820 KB |
testcase_04 | AC | 213 ms
60,104 KB |
testcase_05 | AC | 204 ms
60,724 KB |
ソースコード
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] args) { BufferedReader buff = new BufferedReader(new InputStreamReader(System.in)); try { int count = Integer.parseInt(buff.readLine()); String[] box = buff.readLine().split(" "); int[] posi = new int[count]; int odd = 0, even = 0; for(int i = 0; i < count; ++i){ posi[i] = Integer.parseInt(box[i]); if(posi[i] % 2 == 0){ even++; }else{ odd++; } } System.out.println(Math.abs(odd-even)); } catch (NumberFormatException e) { e.getStackTrace(); } catch (IOException e) { e.getStackTrace(); } catch (Exception e) { e.getStackTrace(); } } }