結果

問題 No.652 E869120 and TimeZone
ユーザー tsuchinaga
提出日時 2019-04-15 16:29:36
言語 Go
(1.23.4)
結果
WA  
実行時間 -
コード長 613 bytes
コンパイル時間 11,387 ms
コンパイル使用メモリ 233,580 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-22 07:57:18
合計ジャッジ時間 12,801 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 5
other AC * 22 WA * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

package main

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

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)

	sc.Scan()
	a, _ := strconv.Atoi(sc.Text())

	sc.Scan()
	b, _ := strconv.Atoi(sc.Text())

	sc.Scan()
	s := sc.Text()
	tz, _ := strconv.ParseFloat(strings.Trim(s, "UTC"), 64)

	// まず9時間前にする
	a = (a + 24 - 9) % 24
	// fmt.Println(a, b, tz)

	// 別の国のtimezoneを反映
	b = b + int((tz-float64(int(tz)))*60)
	if b >= 60 {
		a, b = a+1, b-60
	} else if b < 0 {
		a, b = a-1, b+60
	}
	a = (a + int(tz) + 24) % 24

	fmt.Printf("%02d:%02d\n", a, b)
}
0