結果

問題 No.446 ゆきこーだーの雨と雪 (1)
ユーザー jjjj
提出日時 2016-12-03 00:25:48
言語 Fortran
(gFortran 13.2.0)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 715 bytes
コンパイル時間 1,463 ms
コンパイル使用メモリ 26,236 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-18 12:41:26
合計ジャッジ時間 2,456 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,384 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,384 KB
testcase_05 AC 1 ms
4,376 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,376 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 1 ms
4,380 KB
testcase_14 AC 1 ms
4,376 KB
testcase_15 AC 1 ms
4,380 KB
testcase_16 AC 1 ms
4,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.f90:32:14:

     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