結果
| 問題 |
No.70 睡眠の重要性!
|
| コンテスト | |
| ユーザー |
jj
|
| 提出日時 | 2016-07-30 08:42:41 |
| 言語 | Fortran (gFortran 14.2.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 1,180 bytes |
| コンパイル時間 | 397 ms |
| コンパイル使用メモリ | 33,664 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-06 20:18:24 |
| 合計ジャッジ時間 | 697 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 6 |
ソースコード
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
jj