結果
| 問題 | No.652 E869120 and TimeZone | 
| コンテスト | |
| ユーザー |  ats5515 | 
| 提出日時 | 2018-02-23 22:32:32 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 2 ms / 1,000 ms | 
| コード長 | 919 bytes | 
| コンパイル時間 | 1,022 ms | 
| コンパイル使用メモリ | 81,812 KB | 
| 実行使用メモリ | 5,376 KB | 
| 最終ジャッジ日時 | 2024-06-11 12:17:52 | 
| 合計ジャッジ時間 | 1,840 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 5 | 
| other | AC * 30 | 
ソースコード
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <stdio.h>
using namespace std;
#define int long long
int MOD = 1000000007;
signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int a, b;
	cin >> a >> b;
	a -= 9;
	string S;
	cin >> S;
	int x, y;
	x = y = 0;
	int t = 0;
	for (int i = 4; i < S.size(); i++) {
		if (S[i] != '.') {
			if (t == 0) {
				x *= 10;
				x += (int)(S[i] - '0');
			}
			else {
				y *= 10;
				y += (int)(S[i] - '0');
			}
		}
		else {
			t = 1;
		}
	}
	y = 6 * y;
	if (S[3] == '-') {
		x = -x - 1;
		y = 60 - y;
	}
	a += x;
	b += y;
	while (b >= 60) {
		b -= 60;
		a++;
	}
	while (b < 0) {
		b += 60;
		a--;
	}
	while (a >= 24) {
		a -= 24;
	}
	while (a < 0) {
		a += 24;
	}
	if (a < 10)cout << '0';
	cout << a << ":";
	if (b < 10)cout << '0';
	cout << b << endl;
	
}
            
            
            
        