結果

問題 No.446 ゆきこーだーの雨と雪 (1)
ユーザー jj
提出日時 2016-12-03 00:25:48
言語 Fortran
(gFortran 14.2.0)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 715 bytes
コンパイル時間 2,661 ms
コンパイル使用メモリ 30,964 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-11-27 17:47:58
合計ジャッジ時間 2,546 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 13
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.f90:32:14:

   32 |     read (a,*),ia
      |              1
Warning: Legacy Extension: Comma before i/o item list at (1)

ソースコード

diff #

program main
  implicit none
  character*5::a,b
  read *,a
  read *,b
  if(check_num(a).and.check_num(b)) then
     print '(a)',"OK"
  else
     print '(a)',"NG"
  end if
contains
  logical function check_num(a) result(ok)
    character*5::a
    integer::i,ic,ia,len
    len = LEN_TRIM(a)

    if(len.ge.2.and.a(1:1).eq.'0') then
       ok=.false.
       return
    end if

    do i=1,len
       ic = ICHAR(a(i:i))
       if(ICHAR('0').le.ic.and.ic.le.ICHAR('9')) then
          cycle
       else
          ok=.false.
          return
       end if
    end do

    read (a,*),ia

    if(0.le.ia.and.ia.le.12345) then
       ok=.true.
    else
       ok=.false.
    end if
  end function check_num

end program main
0