結果
問題 | No.409 ダイエット |
ユーザー |
![]() |
提出日時 | 2016-08-06 00:50:36 |
言語 | Fortran (gFortran 14.2.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 631 bytes |
コンパイル時間 | 478 ms |
コンパイル使用メモリ | 32,896 KB |
実行使用メモリ | 10,624 KB |
最終ジャッジ日時 | 2024-11-07 00:30:21 |
合計ジャッジ時間 | 7,032 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 59 WA * 11 TLE * 1 -- * 21 |
ソースコード
program mainimplicit noneinteger*8::N,A,B,W,i,str,str_max,tmp,uplimitinteger*8,allocatable::D(:)integer*8,allocatable::dp(:)read *, N,A,B,Wallocate(D(N))allocate(dp(0:N))read *, Ddp(0) = Wdp(1) = W - A + B*1dp(0) = W + D(1)str_max = 1do i=2,Ntmp = MINVAL(dp(0:str_max)) + D(i)if(tmp.eq.dp(0)) then!tabeta houga kanarazu yoistr_max = 0end if!str ha tamesugi naido str=str_max+1,1,-1dp(str) = dp(str-1) - A + B*strend dodp(0) = tmpstr_max = str_max + 1end doprint '(i0)', MINVAL(dp(0:str_max))end program