結果
問題 | No.24 数当てゲーム |
ユーザー | SagToki |
提出日時 | 2018-05-09 14:06:31 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 128 ms / 5,000 ms |
コード長 | 1,697 bytes |
コンパイル時間 | 4,621 ms |
コンパイル使用メモリ | 75,140 KB |
実行使用メモリ | 56,116 KB |
最終ジャッジ日時 | 2023-09-10 11:18:18 |
合計ジャッジ時間 | 5,562 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 122 ms
55,704 KB |
testcase_01 | AC | 122 ms
55,600 KB |
testcase_02 | AC | 123 ms
56,116 KB |
testcase_03 | AC | 124 ms
55,744 KB |
testcase_04 | AC | 123 ms
55,628 KB |
testcase_05 | AC | 123 ms
55,972 KB |
testcase_06 | AC | 122 ms
55,468 KB |
testcase_07 | AC | 126 ms
55,732 KB |
testcase_08 | AC | 128 ms
55,752 KB |
testcase_09 | AC | 127 ms
55,628 KB |
ソースコード
import java.util.*; public class NumbersGame { public static void main(String[] args){ Scanner scanner = new Scanner(System.in); try{ int Turn = scanner.nextInt(); Integer[] TaroCards = new Integer[4]; int[] num = new int[10]; int ZiroCard ; for(int i = 0 ; i < Turn ; i++){ for(int k = 0 ; k < 4 ; k++){ TaroCards[k] = scanner.nextInt(); } String Ansewer = scanner.next(); if(!(Ansewer.equals("YES") || Ansewer.equals("NO"))){ System.out.println("結果はYESかNOで入力してください"); System.exit(0); } for(int j = 0 ; j < num.length ; j++){ if(Ansewer.equals("YES")){ if(!Arrays.asList(TaroCards).contains(j)){ num[j] = 1; } }else{ if(Arrays.asList(TaroCards).contains(j)){ num[j] = 1; } } } } for(int k = 0 ; k < num.length ; k++){ if(num[k] == 0){ System.out.println(k); } } }catch(InputMismatchException e){ System.out.println("正しく入力してください。"); }catch(Exception E){ System.out.println("予期せぬエラーです。"); } } }