結果

問題 No.305 鍵(2)
ユーザー kohaku_kohakukohaku_kohaku
提出日時 2017-02-04 04:20:29
言語 Java21
(openjdk 21)
結果
AC  
実行時間 200 ms / 2,000 ms
コード長 1,093 bytes
コンパイル時間 1,877 ms
コンパイル使用メモリ 74,344 KB
実行使用メモリ 72,260 KB
平均クエリ数 44.08
最終ジャッジ日時 2023-09-24 00:53:15
合計ジャッジ時間 5,257 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 143 ms
71,840 KB
testcase_01 AC 180 ms
71,964 KB
testcase_02 AC 142 ms
71,788 KB
testcase_03 AC 171 ms
72,192 KB
testcase_04 AC 181 ms
72,260 KB
testcase_05 AC 199 ms
71,608 KB
testcase_06 AC 130 ms
71,796 KB
testcase_07 AC 179 ms
71,708 KB
testcase_08 AC 200 ms
71,640 KB
testcase_09 AC 185 ms
71,940 KB
testcase_10 AC 174 ms
71,468 KB
testcase_11 AC 179 ms
72,228 KB
testcase_12 AC 192 ms
71,696 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int [] ans = new int [10];
        int k=0;
        print(ans);
        String S = sc.nextLine();
        if("10 unlocked".equals(S))return;
        String [] arr = S.split(" ");
        int X = Integer.parseInt(arr[0]);
        while(k<10){
            for(int i=1; i<10; i++){
                ans[k]=i;
                print(ans);
                String tmp = sc.nextLine();
                String [] arrtmp = tmp.split(" ");
                int Y = Integer.parseInt(arrtmp[0]);
                if(Y==10)return;
                if(X<Y){
                    k++;
                    X=Y;
                    break;
                }else if(X>Y){
                    ans[k]=0;
                    k++;
                    break;
                }
            }
        }
    }
    static void print(int [] A){
        for(int i=0; i<10; i++){
            System.out.print(A[i]);
        }
        System.out.println();
        System.out.flush();
    }
}
0