結果

問題 No.3519 A/B問題
コンテスト
ユーザー detteiuu
提出日時 2026-05-01 21:56:39
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 157 ms / 2,000 ms
コード長 854 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 299 ms
コンパイル使用メモリ 85,376 KB
実行使用メモリ 92,064 KB
平均クエリ数 759.47
最終ジャッジ日時 2026-05-01 21:56:47
合計ジャッジ時間 6,668 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

from random import randrange

def question(n, m):
    print("?", n, m)
    res = input()
    #test
    # global a, B
    # n, m = int(n), int(m)
    # res = None
    # if n*a < m*B:
    #     res = "<"
    # elif n*a == m*B:
    #     res = "="
    #     a = n*a-m*B
    # else:
    #     res = ">"
    #     a = n*a-m*B
    # print(a)
    #test
    if res == ">":
        return 1
    elif res == "=":
        return 0
    else:
        return -1

def answer(n):
    print("!", n)

if question(1, str(1)+"0"*100) >= 0:
    answer(str(1)+"0"*100)
    exit()

ans = []
for i in reversed(range(100)):
    for j in reversed(range(1, 10)):
        res = question(1, str(j)+"0"*i)
        if 0 <= res:
            ans.append(j)
            break
    else:
        if ans:
            ans.append(0)
if not ans:
    ans.append(0)

answer("".join(map(str, ans)))
0