結果

問題 No.430 文字列検索
ユーザー jjjj
提出日時 2016-10-02 23:04:29
言語 Fortran
(gFortran 13.2.0)
結果
TLE  
実行時間 -
コード長 744 bytes
コンパイル時間 154 ms
コンパイル使用メモリ 32,256 KB
実行使用メモリ 13,756 KB
最終ジャッジ日時 2024-05-01 10:01:58
合計ジャッジ時間 3,596 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
13,756 KB
testcase_01 TLE -
testcase_02 -- -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

program main
  implicit none
  character*50000::S
  character*10::c(5000)
  integer::clen(5000)
  integer::M,i,j
  integer*8::match=0
  read *,S
  read *,M
  read *,c(1:M)
  clen(1:M) = LEN_TRIM(c(1:M))
!  print *,S(1:LEN_TRIM(S))
!  print *,M
!  print *,c(1:M)
!  print *,clen(1:M)
  do i=1,LEN_TRIM(S)
     do j=1,M
        if(str_eq(S(i:i+clen(j)-1),c(j))) then
           match = match + 1
        end if
     end do
  end do
  print '(i0)',match
contains
  function str_eq(S1,S2) result(equal)
    character(*)::S1,S2
    integer::len,i
    logical::equal
    do i=1,LEN_TRIM(S2)
       if(S1(i:i).ne.S2(i:i)) then
          equal = .false.
          return
       end if
    end do
    equal=.true.
  end function str_eq
end program main
0