結果

問題 No.204 ゴールデン・ウィーク(2)
ユーザー jj
提出日時 2016-09-01 23:23:08
言語 Fortran
(gFortran 14.2.0)
結果
WA  
実行時間 -
コード長 703 bytes
コンパイル時間 332 ms
コンパイル使用メモリ 32,512 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-11-15 17:06:07
合計ジャッジ時間 1,669 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 31 WA * 15
権限があれば一括ダウンロードができます

ソースコード

diff #

program main
  implicit none
  integer::N,i,j,M
  character*14::a
  integer::days(14)
  integer::days2(-13:27)
  data days/14*0/
  read *,N
  read *,a(1:7)
  read *,a(8:14)

  do i=1,14
     if(a(i:i).eq.'o') days(i) = 1
  end do

  M = 0

  do i=1,14
     days2 = 0
     days2(1:14) = days(1:14)
     days2(i:i+N-1) = 1
     M = MAX(M,get_longest(days2))
  end do

  print '(i0)', M
contains
  function get_longest(days2) result(L)
    integer::days2(-13:27),L,M
    integer::i
    L = 0
    M = 0
    do i=-13,27
       if(days2(i).eq.1) then
          M = M + 1
       else
          L = MAX(L,M)
          M = 0
       end if
    end do
    L = MAX(L,M)

  end function get_longest
end program main
0