結果
| 問題 | No.598 オーバーフローファンタジー |
| コンテスト | |
| ユーザー |
horiesiniti
|
| 提出日時 | 2018-03-16 18:10:23 |
| 言語 | Ruby (4.0.2) |
| 結果 |
AC
|
| 実行時間 | 53 ms / 2,000 ms |
| コード長 | 196 bytes |
| 記録 | |
| コンパイル時間 | 293 ms |
| コンパイル使用メモリ | 8,832 KB |
| 実行使用メモリ | 14,848 KB |
| 最終ジャッジ日時 | 2026-05-28 06:32:29 |
| 合計ジャッジ時間 | 3,040 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 28 |
コンパイルメッセージ
Syntax OK
ソースコード
n,h,d,c=STDIN.read.split.map{|e| e.to_i}
h3=h
ans1=h3/d
h3=h3-ans1*d
while h3>0
h3-=d
ans1+=1
end
q=1<<(n-1)
h2=h
ans2=(q-h2)/c
h2=ans2*c+h2
while q>h2
h2+=c
ans2+=1
end
puts [ans1,ans2].min
horiesiniti