結果

問題 No.652 E869120 and TimeZone
ユーザー dazydazy
提出日時 2018-05-04 17:50:57
言語 C++11
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 728 bytes
コンパイル時間 1,470 ms
コンパイル使用メモリ 159,736 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-11 12:24:58
合計ジャッジ時間 2,534 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 5
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"
#define fastcin {\
    cin.tie(0);\
    ios::sync_with_stdio(false);\
}
using namespace std;

int main() {
    fastcin;
    int a, b;
    std::string S;
    cin >> a >> b >> S;

    S.erase(S.begin(), S.begin()+3);
    double diff = stod(S);
    double diffh;
    int diffm;
    diffm = round(modf(diff, &diffh) * 60);
    diffh -= 9;

    b += diffm;
    if(b > 59) {
        b -= 60;
        a++;
    } else if(b < 0) {
        b += 60;
        a--;
    }
    a += diffh;
    if(a > 23) {
        a -= 24;
    } else if(a < 0) {
        a += 24;
    }

    if(a < 10) {
        cout << "0";
    }
    cout << a << ":";
    if(b < 10) {
        cout << "0";
    }
    cout << b << '\n';
    return 0;
}
0