結果

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

ソースコード

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);
    float diff = stof(S);
    int diffh = (int)diff - 9;
    int diffm = (diff - (int)diff) * 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" << a << ":" << b << endl;
    } else {
        cout << a << ":" << b << endl;
    }
    return 0;
}
0