結果

問題 No.652 E869120 and TimeZone
ユーザー 👑 obakyan
提出日時 2019-04-08 18:23:02
言語 Lua
(LuaJit 2.1.1734355927)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 441 bytes
コンパイル時間 202 ms
コンパイル使用メモリ 6,812 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-11 12:28:51
合計ジャッジ時間 1,069 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 5
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

s = io.read()
hour, min, pm, utc = string.match(s, "(%d+) (%d+) UTC([%+%-])([%.%d]+)")
hour, min = tonumber(hour), tonumber(min)
utc_h, utc_m = string.match(utc, "(%d+)%.?(%d?)")
if(utc_m == "") then utc_m = "0" end 
utc_h, utc_m = tonumber(utc_h), tonumber(utc_m)

if(pm == "-") then utc_h, utc_m = -utc_h, -utc_m end 
v = (hour + utc_h - 9) * 60 + utc_m * 6 + min 
v = v % 1440
print(string.format("%02d:%02d", math.floor(v / 60), v % 60))
0