結果

問題 No.9006 マルチバイト文字テスト(テスト用)
ユーザー jj
提出日時 2017-01-31 23:59:41
言語 Fortran
(gFortran 14.2.0)
結果
AC  
実行時間 1 ms / 5,000 ms
コード長 725 bytes
コンパイル時間 925 ms
コンパイル使用メモリ 31,356 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-24 01:41:26
合計ジャッジ時間 1,465 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

program main
  implicit none
  character*300::S
  character*300::SR
  integer::i,len,utf8len
  integer*1::code
  character::c
  S=""
  SR=""
  read *, S
  len = LEN_TRIM(S)
  i = 1
  do
     if(i.gt.len) exit
     utf8len = get_utf8_len(S(i:i))
     SR(len-i-utf8len+2:len-i+1) = S(i:i+utf8len-1)
     i = i + utf8len
  end do
  print '(a)', TRIM(SR)

  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