結果

問題 No.432 占い(Easy)
ユーザー jj
提出日時 2016-10-14 22:52:53
言語 Fortran
(gFortran 14.2.0)
結果
AC  
実行時間 4 ms / 2,000 ms
コード長 589 bytes
コンパイル時間 1,448 ms
コンパイル使用メモリ 32,512 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-22 08:18:45
合計ジャッジ時間 1,066 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

program main
  implicit none
  integer::T,i,j,len
  character*1000::S
  integer::ss(1000)
  read *,T
  do i=1,T
     read *,S
     len = LEN_TRIM(S)
     do j=1,len
        ss(j) = ICHAR(S(j:j))-ICHAR('0')
     end do
     call uranai(ss, len)
  end do
contains
  subroutine uranai(ss, len)
    integer::ss(1000)
    integer::len,i,j,tmp
    do i=1,len-1
       do j=1,len-i
          ss(j) = ss(j) + ss(j+1)
          if(ss(j).ge.10) then
             ss(j) = ss(j)/10 + ss(j)-10
          end if
       end do
    end do
    print '(i0)', ss(1)
  end subroutine uranai
end program main

0