結果

問題 No.491 10^9+1と回文
ユーザー jjjj
提出日時 2017-03-11 00:02:45
言語 Fortran
(gFortran 14.2.0)
結果
WA  
実行時間 -
コード長 761 bytes
コンパイル時間 547 ms
コンパイル使用メモリ 32,128 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-06-24 09:09:53
合計ジャッジ時間 2,946 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 33 WA * 69 RE * 1
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.f90:34:30:

   34 |     write(cformat(5:9),'(i0)'),size(array)
      |                              1
Warning: Legacy Extension: Comma before i/o item list at (1)
Main.f90:15:23:

   15 |   write(uf(3:3),'(i0)'), len-9
      |                       1
Warning: Legacy Extension: Comma before i/o item list at (1)
Main.f90:17:13:

   17 |   read (S,uf), upper
      |             1
Warning: Legacy Extension: Comma before i/o item list at (1)
Main.f90:18:24:

   18 |   read (S(len-8:len),lf), lower
      |                        1
Warning: Legacy Extension: Comma before i/o item list at (1)

ソースコード

diff #

program main
  implicit none
  integer*8::N
  integer*8::upper,lower,len,head,num=0,i
  character*19::S
  character*10::uf='(i0)'
  character*10::lf='(i9)'
  read *,S
  len = LEN_TRIM(S)
  if(len.le.9) then
     print '("0")'
     return
  end if

  write(uf(3:3),'(i0)'), len-9
  read (S(1:1),'(i1)') head
  read (S,uf), upper
  read (S(len-8:len),lf), lower

  do i=0,len-10
     num = num+head*10**i
  end do

  if (lower.ge.num) then
     print '(i0)', (len-10)*9+head-1+(head/num)
  else
     print '(i0)', (len-10)*9+head-1
  end if

contains
  subroutine aprinter(array)
    integer*8::array(:)
    character*32::cformat='(i0,     (1x,i0))'
    write(cformat(5:9),'(i0)'),size(array)
    write(*,cformat) array
  end subroutine aprinter
end program main
0