結果
| 問題 |
No.652 E869120 and TimeZone
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-01-18 03:54:35 |
| 言語 | Nim (2.2.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 1,000 ms |
| コード長 | 686 bytes |
| コンパイル時間 | 6,343 ms |
| コンパイル使用メモリ | 83,100 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-06-11 12:29:06 |
| 合計ジャッジ時間 | 7,229 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 5 |
| other | AC * 30 |
コンパイルメッセージ
/home/judge/data/code/Main.nim(1, 36) Warning: imported and not used: 'math' [UnusedImport] /home/judge/data/code/Main.nim(1, 41) Warning: imported and not used: 'sugar' [UnusedImport] /home/judge/data/code/Main.nim(1, 26) Warning: imported and not used: 'algorithm' [UnusedImport]
ソースコード
import sequtils,strutils,algorithm,math,sugar,macros,strformat
import times
template get*():string = stdin.readLine().strip()
macro unpack*(arr: auto,cnt: static[int]): auto =
let t = genSym(); result = quote do:(let `t` = `arr`;())
for i in 0..<cnt: result[1].add(quote do:`t`[`i`])
let (a,b,S) = (let t = get().split();(t[0].parseInt(),t[1].parseInt(),t[2][3..^1]))
var diff = 0 # 分 :: .5 -> 30 , .1 -> 6
if '.' notin S: diff = S.parseInt() * 60
else:
let (sa,sb) = S[1..^1].split(".").map(parseInt).unpack(2)
diff = sa * 60 + sb * 6
if S[0] == '-': diff *= -1
diff -= 60 * 9
let f = initTimeFormat("HH:mm")
echo (fmt"{a:02d}:{b:02d}".parse(f) + diff.minutes).format(f)