結果

問題 No.652 E869120 and TimeZone
ユーザー ksomemo
提出日時 2018-02-23 23:26:09
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 32 ms / 1,000 ms
コード長 514 bytes
コンパイル時間 383 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-06-11 12:19:59
合計ジャッジ時間 2,400 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 5
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
    a, b, S = input().split()

    a, b = int(a), int(b)
    S = S.replace("UTC", "")

    # UTC
    sign = (-1, 1)[S[0] == "+"]
    x = S[1:].split(".")
    x1, x2 = int(x[0]), 0
    if len(x) > 1:
        x2 = int(x[1])

    # 小数点以下、minutesの調整
    b2 = b + sign * x2 * 6
    m = b2 % 60

    # hourの調整
    h_sub = b2 // 60
    x1_2 = sign * x1 - 9
    h = (a + h_sub + x1_2) % 24

    ans = "{:02d}:{:02d}".format(h, m)

    print(ans)


if __name__ == '__main__':
    main()
0