結果

問題 No.342 一番ワロタww
ユーザー jjjj
提出日時 2017-02-03 21:10:16
言語 Fortran
(gFortran 13.2.0)
結果
WA  
実行時間 -
コード長 1,310 bytes
コンパイル時間 1,227 ms
コンパイル使用メモリ 28,196 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-08-25 18:28:49
合計ジャッジ時間 2,186 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

program main
  implicit none
  character*600::S
  character*600::www
  character*3::c
  character*3::w="w"
  integer::wstart(100),wend(100)
  integer::i,j,len,utf8len,Wl,wlmax,pos
  data wl/0/,wlmax/0/
  read *, S
  len = LEN_TRIM(S)

!get max w len
  i = 1
  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 = 1
  j = 1
  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