結果

問題 No.70 睡眠の重要性!
ユーザー jjjj
提出日時 2016-07-30 08:42:41
言語 Fortran
(gFortran 13.2.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 1,180 bytes
コンパイル時間 246 ms
コンパイル使用メモリ 33,792 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-24 12:26:14
合計ジャッジ時間 703 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

module suimin
  TYPE time
     integer::H
     integer::M
  end type time
  TYPE sleep
     type(time)::shuusin
     type(time)::kishou
     integer::sleep_time
  end type sleep
contains
  integer function kaiseki(s,str,N)
    implicit none
    character*16,allocatable::str(:,:)
    type(sleep),allocatable::s(:)
    integer::colon1,colon2,N,i,total=0

    do i=1,N
       colon1 = INDEX(str(1,i),':')
       colon2 = INDEX(str(2,i),':')
       read(str(1,i)(1:colon1-1),*)                  s(i)%shuusin%H
       read(str(1,i)(colon1+1:LEN_TRIM(str(1,i))),*) s(i)%shuusin%M
       read(str(2,i)(1:colon2-1),*)                  s(i)%kishou%H
       read(str(2,i)(colon2+1:LEN_TRIM(str(2,i))),*) s(i)%kishou%M

       s(i)%sleep_time = MOD(((s(i)%kishou%H +24)*60 + s(i)%kishou%M) &
            - ((s(i)%shuusin%H )*60 + s(i)%shuusin%M), 60*24)
       total = total + s(i)%sleep_time
    end do
    kaiseki = total
  end function kaiseki
end module suimin


program main
  use suimin
  integer::N
  character*16,allocatable::str(:,:)
  type(sleep),allocatable::s(:)

  read *,N
  allocate(str(2,N))
  allocate(s(N))
  read *, str

  print '(i0)', kaiseki(s,str,N)

end program main
0