結果

問題 No.415 ぴょん
コンテスト
ユーザー jj
提出日時 2016-08-26 23:14:10
言語 Fortran
(gFortran 15.2.0)
コンパイル:
gfortran _filename_ -O2 -o ./a.out
実行:
./a.out
結果
TLE  
実行時間 -
コード長 462 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 617 ms
コンパイル使用メモリ 39,940 KB
実行使用メモリ 1,303,900 KB
最終ジャッジ日時 2026-05-08 15:57:21
合計ジャッジ時間 6,044 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 21 TLE * 1 MLE * 3 -- * 2
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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