結果

問題 No.2357 Guess the Function
ユーザー 3lonco3lonco
提出日時 2023-06-23 21:45:05
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 729 bytes
コンパイル時間 670 ms
コンパイル使用メモリ 86,976 KB
実行使用メモリ 91,692 KB
平均クエリ数 3.00
最終ジャッジ日時 2023-09-13 16:44:49
合計ジャッジ時間 2,917 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 101 ms
86,776 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 98 ms
87,380 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,101,1):
        # 式を計算し、a と一致するか確認します
            # B を求めるために、(y + A) % B も一致するか確認します
            for B in range(A+1, 101,1):
                if (x + A) % B == a:
                    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