結果

問題 No.296 n度寝
ユーザー neko_the_shadow
提出日時 2019-12-12 22:14:25
言語 Go
(1.23.4)
結果
AC  
実行時間 9 ms / 1,000 ms
コード長 640 bytes
コンパイル時間 12,362 ms
コンパイル使用メモリ 238,692 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-25 18:37:58
合計ジャッジ時間 13,516 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 16
権限があれば一括ダウンロードができます

ソースコード

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