結果

問題 No.652 E869120 and TimeZone
ユーザー dazy
提出日時 2018-05-04 17:36:05
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 735 bytes
コンパイル時間 1,286 ms
コンパイル使用メモリ 158,976 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-28 01:12:48
合計ジャッジ時間 2,187 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 5
other AC * 22 WA * 8
権限があれば一括ダウンロードができます

ソースコード

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);
    int diffh = (int)diff - 9;
    double ddiffm = (diff - (int)diff);
    int diffm = ddiffm * 60;

    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