結果

問題 No.296 n度寝
ユーザー neko_the_shadowneko_the_shadow
提出日時 2019-12-12 22:14:25
言語 Go
(1.22.1)
結果
AC  
実行時間 9 ms / 1,000 ms
コード長 640 bytes
コンパイル時間 13,374 ms
コンパイル使用メモリ 209,696 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-08 01:32:44
合計ジャッジ時間 12,228 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

package main

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

func main() {
	stdin := bufio.NewScanner(os.Stdin)
	stdin.Split(bufio.ScanWords)
	n, _ := strconv.Atoi(read(stdin))
	h, _ := strconv.Atoi(read(stdin))
	m, _ := strconv.Atoi(read(stdin))
	t, _ := strconv.Atoi(read(stdin))

	now := time.Now()
	x := time.Date(now.Year(), now.Month(), now.Day(), h, m, now.Second(), now.Nanosecond(), now.Location())
	y, _ := time.ParseDuration(fmt.Sprintf("%dm", t))
	for i := 0; i < n-1; i++ {
		x = x.Add(y)
	}
	fmt.Println(x.Hour())
	fmt.Println(x.Minute())
}

func read(stdin *bufio.Scanner) string {
	stdin.Scan()
	return stdin.Text()
}
0