結果

問題 No.81 すべて足すだけの簡単なお仕事です。
ユーザー jjjj
提出日時 2016-12-30 19:57:52
言語 Fortran
(gFortran 13.2.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 1,401 bytes
コンパイル時間 907 ms
コンパイル使用メモリ 27,972 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-09-29 22:38:08
合計ジャッジ時間 2,116 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 1 ms
4,384 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 1 ms
4,384 KB
testcase_10 AC 1 ms
4,500 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 1 ms
4,376 KB
testcase_14 AC 1 ms
4,384 KB
testcase_15 AC 2 ms
4,504 KB
testcase_16 AC 1 ms
4,380 KB
testcase_17 AC 1 ms
4,380 KB
testcase_18 AC 1 ms
4,380 KB
testcase_19 AC 1 ms
4,376 KB
testcase_20 AC 1 ms
4,380 KB
testcase_21 AC 1 ms
4,380 KB
testcase_22 AC 1 ms
4,376 KB
testcase_23 AC 1 ms
4,376 KB
testcase_24 AC 1 ms
4,380 KB
testcase_25 AC 1 ms
4,380 KB
testcase_26 AC 1 ms
4,380 KB
testcase_27 AC 1 ms
4,376 KB
testcase_28 AC 1 ms
4,376 KB
testcase_29 AC 2 ms
4,384 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.f90:35:35:

         write(*,'(a)',advance='no'),"-"
                                   1
Warning: Legacy Extension: Comma before i/o item list at (1)
Main.f90:49:35:

         write(*,'(a)',advance='no'),"-"
                                   1
Warning: Legacy Extension: Comma before i/o item list at (1)

ソースコード

diff #

program main
  implicit none
  integer*8::N,i,dot,len,borrow,carry
  integer*8::big,small,big_t,small_t
  integer*8,parameter::keta=10000000000_8
  character*22,allocatable::input(:)

  data big_t,small_t/2*0/
  read *,N
  allocate(input(N))
  read *, input

  do i=1,N
     len = LEN_TRIM(input(i))
     dot = SCAN(input(i),'.')
     if(dot.ne.0) then
        read (input(i)(1:dot-1),*) big
        read (input(i)(dot+1:len),*) small
        small = 10**(10-len+dot)*small
     else
        read (input(i)(1:len),*) big
        small = 0
     end if
     if(input(i)(1:1).eq.'-') then
        small = -small
     end if
     big_t = big_t + big
     small_t = small_t + small
  end do

  if(big_t.eq.0) then
     carry = small_t/keta
     big_t = big_t + carry
     if(big_t.eq.0.and.small_t.lt.0) then
        write(*,'(a)',advance='no'),"-"
     end if
     small_t = ABS(MOD(small_t,keta))
  else if((small_t.ge.0.and.big_t.ge.0).or. &
       (small_t.le.0.and.big_t.le.0)) then
! same sign
     carry = small_t/keta
     big_t = big_t + carry
     small_t = ABS(MOD(small_t,keta))
  else
! diff sign
     if(big_t.le.0) then
        big_t   = -big_t
        small_t = -small_t
        write(*,'(a)',advance='no'),"-"
     end if
     borrow = ABS(small_t/keta) + 1
     big_t  = big_t - borrow
     small_t = borrow*keta + small_t
  end if
  print '(i0,".",i10.10)',big_t,small_t
end program main
0