結果

問題 No.305 鍵(2)
ユーザー uwiuwi
提出日時 2015-11-27 22:36:07
言語 Java19
(openjdk 21)
結果
AC  
実行時間 179 ms / 2,000 ms
コード長 1,173 bytes
コンパイル時間 3,443 ms
コンパイル使用メモリ 75,600 KB
実行使用メモリ 73,604 KB
平均クエリ数 86.69
最終ジャッジ日時 2023-09-23 20:54:13
合計ジャッジ時間 6,926 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 166 ms
71,556 KB
testcase_01 AC 176 ms
72,004 KB
testcase_02 AC 169 ms
72,136 KB
testcase_03 AC 167 ms
72,564 KB
testcase_04 AC 164 ms
70,076 KB
testcase_05 AC 169 ms
72,004 KB
testcase_06 AC 140 ms
71,668 KB
testcase_07 AC 179 ms
71,704 KB
testcase_08 AC 165 ms
71,832 KB
testcase_09 AC 163 ms
72,440 KB
testcase_10 AC 169 ms
71,436 KB
testcase_11 AC 167 ms
71,640 KB
testcase_12 AC 164 ms
73,604 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package contest;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;

public class Q768T {
	static Scanner in;
	static PrintWriter out;
	static String INPUT = "";
	
	static void solve()
	{
		char[] u = new char[10];
		Arrays.fill(u, '0');
		for(int i = 0;i < 10;i++){
			int max = -1;
			int argmax = -1;
			for(int j = 0;j <= 9;j++){
				u[i] = (char)('0'+j);
				int res = test(u);
				if(res == 10)return;
				if(res > max){
					max = res;
					argmax = j;
				}
			}
			u[i] = (char)('0'+argmax);
		}
		throw new RuntimeException();
	}
	
	static int test(char[] a)
	{
		out.println(new String(a));
		out.flush();
		int cor = ni();
		in.next();
		return cor;
	}
	
	public static void main(String[] args) throws Exception
	{
		in = INPUT.isEmpty() ? new Scanner(System.in) : new Scanner(INPUT);
		out = new PrintWriter(System.out);
		
		solve();
		out.flush();
	}
	
	static int ni() { return Integer.parseInt(in.next()); }
	static long nl() { return Long.parseLong(in.next()); }
	static double nd() { return Double.parseDouble(in.next()); }
	static void tr(Object... o) { if(INPUT.length() != 0)System.out.println(Arrays.deepToString(o)); }
}
0