結果

問題 No.70 睡眠の重要性!
ユーザー k.hk.h
提出日時 2019-08-04 09:42:24
言語 Go
(1.22.1)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 611 bytes
コンパイル時間 13,021 ms
コンパイル使用メモリ 211,184 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-22 03:11:31
合計ジャッジ時間 12,894 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	var N, total, s, e, t int
	sc := bufio.NewScanner(os.Stdin)
	sc.Scan()
	N, _ = strconv.Atoi(sc.Text())
	for i := 0; i < N; i++ {
		sc.Scan()
		tokens := strings.Split(sc.Text(), " ")
		t, _ = strconv.Atoi(strings.Split(tokens[0], ":")[0])
		s = t * 60
		t, _ = strconv.Atoi(strings.Split(tokens[0], ":")[1])
		s += t
		t, _ = strconv.Atoi(strings.Split(tokens[1], ":")[0])
		e = t * 60
		t, _ = strconv.Atoi(strings.Split(tokens[1], ":")[1])
		e += t
		if e < s {
			e += 24 * 60
		}
		total += e - s
	}
	fmt.Println(total)
}
0