結果

問題 No.1187 皇帝ペンギン
ユーザー mlihua09
提出日時 2020-08-22 14:58:07
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 61 ms / 1,000 ms
コード長 400 bytes
コンパイル時間 143 ms
コンパイル使用メモリ 82,384 KB
実行使用メモリ 70,532 KB
平均クエリ数 16.44
最終ジャッジ日時 2024-07-17 06:22:54
合計ジャッジ時間 6,137 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 54
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

x = 0

y = 1000



while x < y:
    
    
    z = (x + y + 1) // 2
    
    
    print('?', z)
    sys.stdout.flush()
    
    if input() == 'safe':
        
        
        x = z
        
        
        continue
    
    print('?', z + 1)
    sys.stdout.flush()
    
    if input() == 'safe':
        
        x = z + 1
    else:
        
        y = z - 1
        
    
print('!', x)
0