結果
問題 | No.253 ロウソクの長さ |
ユーザー |
|
提出日時 | 2016-10-02 19:21:35 |
言語 | Python2 (2.7.18) |
結果 |
AC
|
実行時間 | 41 ms / 2,000 ms |
コード長 | 484 bytes |
コンパイル時間 | 151 ms |
コンパイル使用メモリ | 6,912 KB |
実行使用メモリ | 25,232 KB |
平均クエリ数 | 21.11 |
最終ジャッジ日時 | 2024-07-17 00:27:22 |
合計ジャッジ時間 | 3,600 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 36 |
ソースコード
import sysdef ask(n):print '?', nsys.stdout.flush()return int(raw_input())def ans(n):print '!', nsys.stdout.flush()exit()res = ask(100)if res == 0:ans(100)high = 100 if res < 0 else 10**9low = 0i = 1while high - low > 1:mid = (high+low)/2res = ask(mid-i)if res == 0:ans(mid)if res > 0:low = midelse:high = midi += 1res = ask(low-i)if res == 0:ans(low)else:ans(high)