結果

問題 No.652 E869120 and TimeZone
コンテスト
ユーザー arukuka
提出日時 2018-02-23 23:29:36
言語 D
(dmd 2.112.0)
コンパイル:
dmd -fPIE -m64 -w -wi -O -release -inline -I/opt/dmd/src/druntime/import/ -I/opt/dmd/src/phobos -L-L/opt/dmd/linux/lib64/ -fPIC _filename_
実行:
./Main
結果
WA  
実行時間 -
コード長 923 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,573 ms
コンパイル使用メモリ 124,780 KB
実行使用メモリ 7,720 KB
最終ジャッジ日時 2026-03-05 19:23:42
合計ジャッジ時間 2,052 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3 WA * 2
other AC * 3 WA * 28
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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