結果

問題 No.652 E869120 and TimeZone
ユーザー bal4ubal4u
提出日時 2019-04-23 07:53:18
言語 C
(gcc 13.3.0)
結果
AC  
実行時間 1 ms / 1,000 ms
コード長 516 bytes
コンパイル時間 331 ms
コンパイル使用メモリ 29,824 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-11 12:29:19
合計ジャッジ時間 1,195 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 5
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

// yukicoder: No.651 E869120 and Driving
// 2019.4.23 bal4u

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main()
{
	int a, b, h, m, w, tm;
	char s[10];

	scanf("%d%d%s", &a, &b, s);
	tm = a*60+b;
	w = strlen(s);
	m = 0;
	if (w >= 3 && s[w-2] == '.')
		m = 6*(s[w-1] & 0xf);
	h = atoi(s+3);
	if (h >= 9) tm += (h-9)*60+m;
	else if (s[3] == '-') tm -= (9-h)*60+m;
	else tm -= (9-h)*60 - m;
	if (tm < 0) tm += 1440;
	else if (tm >= 1440) tm -= 1440;
	printf("%02d:%02d\n", tm/60, tm%60);
	return 0;
}
0