結果

問題 No.652 E869120 and TimeZone
ユーザー arukuka
提出日時 2018-02-23 23:32:51
言語 D
(dmd 2.109.1)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 923 bytes
コンパイル時間 1,837 ms
コンパイル使用メモリ 146,532 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-06-12 23:55:13
合計ジャッジ時間 2,520 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 5
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

import std.stdio;
import std.range;
import std.array;
import std.string;
import std.conv;
import std.typecons;
import std.algorithm;
import std.container;
import std.typecons;
import std.random;
import core.time;

void main()
{
	auto inputs = readln.chomp.split;
	auto a = inputs[0].to!int;
	auto b = inputs[1].to!int;
	auto op = inputs[2][3];
	auto d = map!(to!int) = inputs[2][4..$].split = ".";
	int dh = d[0];
	int dmp;
	if (d.length > 1) {
		dmp = d[1];
	} else {
		dmp = 0;
	}
	auto f = (int a, int b, char op) {
		final switch (op) {
			case '+': return a + b;
			case '-': return a - b;
		}
	};
	int nh = f(f(a, 9, '-'), dh, op);
	int nm = f(b, dmp * 6, op);
	for (;;) {
		bool g = false;
		if (nm >= 60) {
			++nh;
			nm = nm % 60;
			g |= true;
		}
		if (nm < 0) {
			--nh;
			nm = (nm + 60) % 60;
			g |= true;
		}
		if (!g) {
			break;
		}
	}
	nh = (nh + 24 * (1 << 10)) % 24;
	writefln("%02d:%02d", nh, nm);
}
0