結果
| 問題 |
No.253 ロウソクの長さ
|
| コンテスト | |
| ユーザー |
jj
|
| 提出日時 | 2016-08-26 22:00:32 |
| 言語 | Fortran (gFortran 14.2.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 943 bytes |
| コンパイル時間 | 198 ms |
| コンパイル使用メモリ | 31,744 KB |
| 実行使用メモリ | 25,220 KB |
| 平均クエリ数 | 37.03 |
| 最終ジャッジ日時 | 2024-07-16 10:55:20 |
| 合計ジャッジ時間 | 3,053 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 35 WA * 1 |
ソースコード
program main
implicit none
integer,parameter::limit=100
integer::upper=10**9,lower,mid
integer::i,ans,query
integer,parameter::short=-1,long=1,same=0
integer*8::N
query = 99
call ask(query)
read *,ans
if(ans.eq.same) then
print '("!",i0)',query
return
else if(ans.eq.short) then
query = 0
do i=1,limit-1
call ask(query)
read *,ans
if(ans.eq.same) then
print '("!",i0)',i
return
end if
end do
print '("!",i0)',query
end if
lower = 100
do i=1,limit-1
mid = (lower+upper)/2
query = mid-i
call ask(query)
read *,ans
if(ans.eq.same) then
print '("!",i0)',i+query
return
else if(ans.eq.short) then
upper = mid
else
lower = mid
end if
end do
contains
subroutine ask(query)
integer::query
print '("?",i0)',query
end subroutine ask
end program main
jj