結果

問題 No.87 Advent Calendar Problem
ユーザー jj
提出日時 2016-08-15 21:57:43
言語 Fortran
(gFortran 14.2.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 658 bytes
コンパイル時間 1,039 ms
コンパイル使用メモリ 31,996 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-07 18:02:20
合計ジャッジ時間 1,200 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

function get_num(N) result(t)
  integer*8::N,t
  if(MOD(N,400).eq.0) then
     t = 2
  else if(MOD(N,100).eq.0) then
     t = 1
  else if(MOD(N,4).eq.0) then
     t = 2
  else
     t = 1
  end if
end function get_num

program main
  implicit none
  interface
     function get_num(N) result(t)
       integer*8::N,t
     end function get_num
  end interface
  integer*8::N,M,i,youbi,onaji
  read *,N
  M = (N-2014)/400

  onaji = 0
  youbi = 0
  do i=2015,(N-M*400)
     youbi = MOD(youbi+get_num(i),7)
     if(youbi.eq.0) then
        onaji = onaji + 1
     end if
!     print '(i0," ",i0)', i, youbi
  end do

  print '(i0)', onaji + M*57
end program main
0