結果
問題 |
No.78 クジ付きアイスバー
|
ユーザー |
![]() |
提出日時 | 2017-03-20 05:28:58 |
言語 | Fortran (gFortran 14.2.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 836 bytes |
コンパイル時間 | 558 ms |
コンパイル使用メモリ | 32,512 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-05 00:40:16 |
合計ジャッジ時間 | 1,857 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 35 |
ソースコード
program main implicit none integer*8::N,K,atari,buy,total ! character*50::S integer::S(50) integer::i data S/50*0/ data atari/0/,buy/0/ read *,N, K read '(50i1)',S do i=1,MIN(N,K) if(atari.eq.0) then buy = buy + 1 else atari = atari - 1 end if atari = atari + S(i) end do if(N.gt.K .or. atari.ge.buy) then print '(i0)', buy return end if ! print *,"first:", buy, atari if((K-N-1)/N.ge.1) then total = buy + (buy - atari) * ((K-N-1)/N) else total = buy end if ! print *,"second:", total, (K-N-1)/N buy = 0 do i=1,(K-((K-N-1)/N+1)*N) if(atari.eq.0) then buy = buy + 1 else atari = atari - 1 end if atari = atari + S(i) end do total = total + buy print '(i0)', total end program main