結果

問題 No.305 鍵(2)
ユーザー uwi
提出日時 2015-11-27 22:36:07
言語 Java
(openjdk 23)
結果
AC  
実行時間 186 ms / 2,000 ms
コード長 1,173 bytes
コンパイル時間 3,964 ms
コンパイル使用メモリ 78,976 KB
実行使用メモリ 71,008 KB
平均クエリ数 86.69
最終ジャッジ日時 2024-07-16 20:45:25
合計ジャッジ時間 6,616 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

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