結果
| 問題 |
No.652 E869120 and TimeZone
|
| コンテスト | |
| ユーザー |
kichirb3
|
| 提出日時 | 2018-03-06 23:30:40 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,053 bytes |
| コンパイル時間 | 647 ms |
| コンパイル使用メモリ | 73,216 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-09-22 02:07:26 |
| 合計ジャッジ時間 | 1,887 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 5 |
| other | AC * 26 WA * 4 |
ソースコード
// No.652 E869120 and TimeZone
// https://yukicoder.me/problems/no/652
//
#include <iostream>
#include <string>
#include <algorithm>
#include <iomanip>
using namespace std;
int decode_time(string &S);
int main() {
std::cin.tie(nullptr);
std::ios::sync_with_stdio(false);
int a, b;
string S;
cin >> a >> b >> S;
int japanese_time = a * 60 + b;
int time_diff = decode_time(S);
int ans = japanese_time + time_diff - 540;
if (ans < 0)
ans += 24 * 60;
else if (ans >= 24 * 60)
ans -= 24 * 60;
cout << setw(2) << setfill('0') << ans / 60 << ":";
cout << setw(2) << setfill('0') << ans % 60 << endl;
}
int decode_time(string &S) {
int ans;
auto pos = S.find(".");
if (pos != string::npos) {
int hh = stoi(S.substr(3, pos)) * 60;
int mm = stoi(S.substr(S.size()-1, S.size())) * 6;
if (hh < 0)
hh -= mm;
else
hh += mm;
ans = hh;
} else {
ans = stoi(S.substr(3, S.size())) * 60;
}
return ans;
}
kichirb3