結果

問題 No.2357 Guess the Function
ユーザー ks2mks2m
提出日時 2023-06-23 21:39:45
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,000 bytes
コンパイル時間 2,842 ms
コンパイル使用メモリ 77,120 KB
実行使用メモリ 76,796 KB
平均クエリ数 3.00
最終ジャッジ日時 2023-09-13 16:39:27
合計ジャッジ時間 7,448 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 289 ms
76,216 KB
testcase_02 AC 299 ms
75,548 KB
testcase_03 AC 285 ms
76,348 KB
testcase_04 AC 297 ms
76,796 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 286 ms
74,944 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 303 ms
75,296 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int m = 100;
		int m2 = 1000;

		int max = 0;
		for (int x = 1; x < m; x++) {
			for (int y = x + 1; y <= m; y++) {
				Map<Integer, Integer> map = new HashMap<>();
				int cnt = 0;
				for (int a = 0; a < m; a++) {
					for (int b = a + 1; b <= m; b++) {
						int v1 = (x + a) % b;
						int v2 = (y + a) % b;
						map.put(v1 * m2 + v2, a * m2 + b);
						cnt++;
					}
				}
				max = Math.max(max, map.size());
				if (map.size() == 3903) {
					System.out.println("? " + x);
					int v1 = sc.nextInt();
					System.out.println("? " + y);
					int v2 = sc.nextInt();
					int v = v1 * m2 + v2;
					int ab = map.get(v);
					int a = ab / m2;
					int b = ab % m2;
					System.out.println("! " + a + " " + b);
					sc.close();
					return;
				}
			}
		}
		sc.close();
		System.out.println(max);
	}
}
0