結果
| 問題 |
No.652 E869120 and TimeZone
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-04-17 14:14:40 |
| 言語 | D (dmd 2.109.1) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 1,000 ms |
| コード長 | 654 bytes |
| コンパイル時間 | 8,442 ms |
| コンパイル使用メモリ | 304,024 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-13 00:34:43 |
| 合計ジャッジ時間 | 9,511 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 5 |
| other | AC * 30 |
ソースコード
import std.algorithm, std.container, std.conv, std.math, std.range, std.typecons, std.stdio, std.string;
import std.regex;
void readV(T...)(ref T t){auto r=readln.splitter;foreach(ref v;t){v=r.front.to!(typeof(v));r.popFront;}}
void main()
{
int a, b; string s; readV(a, b, s);
auto m = s.matchFirst(r"UTC(\+|-)(\d+)(\.(\d))?");
auto c = m[1], d = m[2].to!int, e = m[4].empty ? 0 : m[4].to!int;
a -= 9;
if (c == "+") {
a += d;
b += e*6;
} else {
a -= d;
b -= e*6;
}
if (b < 0) { b += 60; --a; }
if (b > 59) { b -= 60; ++a; }
if (a < 0) { a += 24; }
if (a > 23) { a -= 24; }
writefln("%02d:%02d", a, b);
}