結果

問題 No.415 ぴょん
ユーザー jj
提出日時 2016-08-26 23:14:10
言語 Fortran
(gFortran 14.2.0)
結果
MLE  
実行時間 -
コード長 462 bytes
コンパイル時間 1,551 ms
コンパイル使用メモリ 31,232 KB
実行使用メモリ 788,480 KB
最終ジャッジ日時 2024-11-08 09:46:57
合計ジャッジ時間 2,970 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 3 MLE * 1 -- * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

program main
  implicit none
  integer::N,D,M
  integer::i,cur,total,step,next
  integer,allocatable::ashiba(:)
  read *,N,D
  allocate(ashiba(0:D))
  cur = 0
  ashiba=1
  total = 0
  M = D-(N-N/D*D)

  do i=1,D
     ashiba(cur) =0
     next = MOD(cur + M,D)
     step = (N + next - cur)/D
     total = total + step
     if(ashiba(next).eq.0) then
        total = total -1
        exit
     end if
     cur = next
  end do

  print '(i0)',total
end program main
0