結果
問題 | No.598 オーバーフローファンタジー |
ユーザー |
![]() |
提出日時 | 2018-03-16 18:10:23 |
言語 | Ruby (3.4.1) |
結果 |
AC
|
実行時間 | 105 ms / 2,000 ms |
コード長 | 196 bytes |
コンパイル時間 | 39 ms |
コンパイル使用メモリ | 7,552 KB |
実行使用メモリ | 12,160 KB |
最終ジャッジ日時 | 2024-12-21 14:32:12 |
合計ジャッジ時間 | 4,455 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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