結果
問題 | No.355 数当てゲーム(2) |
ユーザー |
![]() |
提出日時 | 2016-05-31 17:45:00 |
言語 | Java (openjdk 23) |
結果 |
TLE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 1,100 bytes |
コンパイル時間 | 3,530 ms |
コンパイル使用メモリ | 80,528 KB |
実行使用メモリ | 85,576 KB |
最終ジャッジ日時 | 2024-07-16 23:52:01 |
合計ジャッジ時間 | 10,326 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | TLE * 1 -- * 51 |
ソースコード
import java.util.*;public class Exercise39{public static void main (String[] args){Scanner sc = new Scanner(System.in);LinkedList<Integer> num = new LinkedList<Integer>();for(int n = 0; n < 10; n++){num.add(n);}int[] array = new int[4];for (int i = 0; i < array.length; i++){Collections.shuffle(num);array[i] = num.poll();}h: for (int n = 0; n < 100; n++){ArrayList<Integer> q = new ArrayList<Integer>();int left = 0;int right = 0;for(int a = 0; a < 4; a++){int x = sc.nextInt();if (q.indexOf(x) != -1){break h;}q.add(x);}for (int k = 0; k < 4; k++){if (q.get(k) == array[k]){left++;}for(int j = 0; j < 4; j++){if (k == j){continue;}if (q.get(k) == array[j]){right++;}}}System.out.println(left + " " + right);System.out.flush();if (left == 4 && right == 0){break;}}}}