結果

問題 No.164 ちっちゃくないよ!!
ユーザー jjjj
提出日時 2016-09-13 23:58:01
言語 Fortran
(gFortran 13.2.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 920 bytes
コンパイル時間 1,561 ms
コンパイル使用メモリ 27,000 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-10 20:01:41
合計ジャッジ時間 1,698 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

program main
  implicit none
  character*12::s
  integer*8::i,n
  integer*8,allocatable::num(:)
  read *,n
  allocate(num(n))
  do i=1,n
     read *,s
     num(i) = get_min(s)
  end do
  print '(i0)',MINVAL(num)
contains
  function get_num(c) result(n)
    character,intent(in)::c
    integer::ic,n
    ic=ICHAR(c)
    if(ic.ge.ICHAR('0').and.ic.le.ICHAR('9')) then
       n = ic-ICHAR('0')
    else
       n = ic-ICHAR('A')+10
    end if
  end function get_num

  function get_sinsuu(s) result(minn)
    character*12,intent(in)::s
    integer::minn,i
    minn = 2
    do i=1,LEN_TRIM(s)
       minn = MAX(minn, get_num(s(i:i))+1)
    end do
  end function get_sinsuu
  function get_min(s) result(m)
    character*12,intent(in)::s
    integer::sinsuu,i
    integer*8::m
    m = 0
    sinsuu = get_sinsuu(s)
    do i=1,LEN_TRIM(s)
       m = m * sinsuu + get_num(s(i:i))
    end do
  end function get_min
end program main
0