結果
問題 | No.99 ジャンピング駒 |
ユーザー | nCk_cv |
提出日時 | 2016-01-29 16:12:03 |
言語 | Java21 (openjdk 21) |
結果 |
RE
|
実行時間 | - |
コード長 | 623 bytes |
コンパイル時間 | 2,232 ms |
コンパイル使用メモリ | 77,332 KB |
実行使用メモリ | 74,548 KB |
最終ジャッジ日時 | 2023-10-21 16:35:42 |
合計ジャッジ時間 | 9,073 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge10 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | RE | - |
testcase_01 | RE | - |
testcase_02 | RE | - |
testcase_03 | RE | - |
testcase_04 | AC | 796 ms
70,788 KB |
testcase_05 | WA | - |
ソースコード
import java.util.*; import java.math.*; import java.io.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int a = 0; int b = 0; ArrayList<Integer> list = new ArrayList<Integer>(); for(int i = 0; i < N; i++) { list.add(sc.nextInt()); } Collections.sort(list); boolean ok = true; while(ok) { ok = false; for(int i = 1; i < list.size(); i++) { if(list.get(i) % 2 != list.get(i-1) % 2) { list.remove(i-1); list.remove(i-1); i -= 2; ok = true; } } } System.out.println(list.size()); } }