結果

問題 No.380 悪の台本
ユーザー jjjj
提出日時 2016-08-30 21:20:32
言語 Fortran
(gFortran 13.2.0)
結果
RE  
実行時間 -
コード長 2,133 bytes
コンパイル時間 574 ms
コンパイル使用メモリ 32,512 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-24 14:44:31
合計ジャッジ時間 2,118 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 WA -
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 WA -
testcase_08 RE -
testcase_09 RE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.f90:7:33:

    7 |      read (*,'(a)',advance='yes'),str
      |                                 1
Warning: Legacy Extension: Comma before i/o item list at (1)

ソースコード

diff #

program main
  implicit none
  integer::N
  character*102400::str

  do
     read (*,'(a)',advance='yes'),str
     if(str(1:1).eq." ") exit

     if(check(str).eqv..true.) then
        print '(a)', "CORRECT (maybe)"
     else
        print '(a)', "WRONG!"
     end if
  end do
contains
  logical function check(str) result(l)
    integer::i
    character*7::strend
    character*102400::str
    l = .false.

    if(str(1:5).eq."rabi ") then
       do i=6,LEN(str)
          if((ICHAR(str(i:i)).ge.ICHAR('a').and. &
               ICHAR(str(i:i)).le.ICHAR('z')).or. &
               (ICHAR(str(i:i)).ge.ICHAR('A').and. &
               ICHAR(str(i:i)).le.ICHAR('Z')).or. &
               (ICHAR(str(i:i)).ge.ICHAR('0').and. &
               ICHAR(str(i:i)).le.ICHAR('9'))) then
             l = .true.
             return
          end if
       end do
    end if

    if(LEN(str).lt.7) return

    call get_capital_str(str,strend)

    if(str(1:5).eq."digi ") then
       do i=2,5
          if(strend(i:i+2).eq."NYO") then
             l = .true.
             exit
          end if
       end do
    else if(str(1:5).eq."petit ") then
       do i=2,5
          if(strend(i:i+2).eq."NYU") then
             l = .true.
             exit
          end if
       end do
    else if(str(1:5).eq."gema ") then
       do i=1,4
          if(strend(i:i+3).eq."GEMA") then
             l = .true.
             exit
          end if
       end do
    else if(str(1:5).eq."piyo ") then
       do i=2,5
          if(strend(i:i+2).eq."PYO") then
             l = .true.
             exit
          end if
       end do
    end if
  end function check

  character function get_capital(c) result(cc)
    character::c
    if(ICHAR(c).ge.ICHAR('a').and.ICHAR(c).le.ICHAR('z')) then
       cc = CHAR(ICHAR(c)-ICHAR('a')+ICHAR('A'))
    else
       cc = c
    end if
  end function get_capital

  subroutine get_capital_str(str, strend)
    integer::i
    character*7::strend
    character*102400::str
    do i=1,7
       strend(i:i) = get_capital(str(i+LEN_TRIM(str)-7:i+LEN_TRIM(str)-7))
    end do
  end subroutine get_capital_str

end program main
0