結果

問題 No.2357 Guess the Function
ユーザー 3lonco3lonco
提出日時 2023-06-23 21:42:34
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 709 bytes
コンパイル時間 438 ms
コンパイル使用メモリ 86,916 KB
実行使用メモリ 94,204 KB
平均クエリ数 2.91
最終ジャッジ日時 2023-09-13 16:41:53
合計ジャッジ時間 2,491 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 95 ms
87,032 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

def find_AB(x, y, a, b):
    # A を 0 から B-1 の範囲で探索します
    for A in range(0,100):
        # 式を計算し、a と一致するか確認します
        if (x + A) % b == a:
            # B を求めるために、(y + A) % B も一致するか確認します
            for B in range(A+1, 100):
                if (y + A) % B == b:
                    return A, B

    # 解が見つからなかった場合は None を返します
    return None


x=2
output="? "+str(x)

print(output,flush=True)
a=int(input())
y=3
output="? "+str(y)
print(output,flush=True)
b=int(input())


result = find_AB(x, y, a, b)
if result:
    A, B = result
    ans="! "+str(A)+" "+str(B)
    print(ans)
0