結果
| 問題 |
No.652 E869120 and TimeZone
|
| コンテスト | |
| ユーザー |
tac
|
| 提出日時 | 2019-07-26 15:46:16 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 1,000 ms |
| コード長 | 1,151 bytes |
| コンパイル時間 | 1,314 ms |
| コンパイル使用メモリ | 167,892 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-11 12:30:09 |
| 合計ジャッジ時間 | 2,170 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 5 |
| other | AC * 30 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rep3(i, l, n) for (int i = l; i < n; ++i)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define out(a) cout << a << endl
#define outa(a, n) rep(_, n) cout << a[_] << " "; cout << endl
#define SZ(v) (int)v.size()
#define inf (int)(1e9+7)
int main() {
int a, b;
cin >> a >> b;
string s;
cin >> s;
double tmp = stod(s.substr(3, SZ(s) - 3));
char op = (tmp - 9 > 0 ? '+' : '-');
tmp = abs(9 - tmp);
int n1 = tmp;
tmp -= n1;
tmp *= 10;
int n2 = (tmp + 0.9);
if (op == '-') {
int ti = 60 * n1 + 6 * n2;
while (ti--) {
if (a == 0 && b == 0) a = 24;
if (b == 0) { a--; b = 59; continue; }
b--;
}
} else {
b += 6 * n2;
if (b >= 60) {a++; b -= 60; }
(a += n1) %= 24;
}
out(setw(2) << setfill('0') << a << ":" << setw(2) << setfill('0') << b);
}
tac