結果
| 問題 |
No.70 睡眠の重要性!
|
| コンテスト | |
| ユーザー |
kat0rik
|
| 提出日時 | 2020-01-16 17:06:41 |
| 言語 | Go (1.23.4) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 589 bytes |
| コンパイル時間 | 14,045 ms |
| コンパイル使用メモリ | 227,200 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-23 22:02:04 |
| 合計ジャッジ時間 | 14,578 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 6 |
ソースコード
package main
import (
"fmt"
"strconv"
"strings"
)
func main() {
var N int
fmt.Scan(&N)
var h, m int
for i := 0; i < N; i++ {
var s1, s2 string
fmt.Scan(&s1, &s2)
h1, _ := strconv.Atoi(strings.Split(s1, ":")[0])
m1, _ := strconv.Atoi(strings.Split(s1, ":")[1])
h2, _ := strconv.Atoi(strings.Split(s2, ":")[0])
m2, _ := strconv.Atoi(strings.Split(s2, ":")[1])
// 23:59 -> 05:41 => 05:42
// h1:m1 -> h2:m2
if m1 > m2 {
h2--
if h2 < 0 {
h2 += 24
}
m2 += 60
}
m += m2 - m1
if h1 > h2 {
h2 += 24
}
h += h2 - h1
}
fmt.Println(h*60 + m)
}
kat0rik