結果

問題 No.342 一番ワロタww
ユーザー jjjj
提出日時 2017-02-03 21:15:28
言語 Fortran
(gFortran 13.2.0)
結果
AC  
実行時間 1 ms / 5,000 ms
コード長 1,395 bytes
コンパイル時間 1,294 ms
コンパイル使用メモリ 32,880 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-23 13:34:43
合計ジャッジ時間 1,923 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

program main
  implicit none
  character*600::S
  character*600::www
  character*3::w="w"
  integer::wstart(100),wend(100)
  integer::i,j,len,utf8len,Wl,wlmax,start
  data wl/0/,wlmax/0/
  read *, S
  len = LEN_TRIM(S)
  start = VERIFY(TRIM(S),w)
  if(start.eq.0) then
     print '(a)'
     return
  end if

!get max w len
  i = start
  do
     if(i.gt.len) exit
     utf8len = get_utf8_len(S(i:i))
     if(utf8len.eq.3.and.S(i:i+2).eq.w) then
        wl = wl + 1
        if(wl.gt.wlmax) then
           wlmax = max(wl, wlmax)
        end if
     else
        wl = 0
     end if
     i = i + utf8len
  end do

  if((wlmax.eq.0).or.(wlmax*3.eq.len)) then
     print '(a)'
     return
  end if

  www = REPEAT(w,wlmax)

  i = start
  j = start
  do
     if(i.gt.len-wlmax*3+1) exit
     utf8len = get_utf8_len(S(i:i))
     if(S(i:i+2).eq.w) then
        if(TRIM(www).eq.S(i:i+wlmax*3-1)) then
           if(i.ne.1) print '(a)',S(j:i-1)
        end if
        j = i + utf8len
     else
     end if
     i = i + 1
  end do
  return
contains

  logical function is_ascii(c) result(l)
    character::c
    l = .not.BTEST(ICHAR(c,1),7)
  end function is_ascii
  integer function get_utf8_len(c) result(len)
    character::c
    integer*1::ic
    ic = ICHAR(c,1)
    if(.not.BTEST(ic,7)) then
       len = 1
    else
       len = LEADZ(NOT(ic))
    end if
  end function get_utf8_len
end program main
0