結果

問題 No.652 E869120 and TimeZone
ユーザー IkomIkom
提出日時 2018-02-23 22:52:46
言語 C++11
(gcc 11.4.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 879 bytes
コンパイル時間 2,732 ms
コンパイル使用メモリ 145,744 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-08-30 20:02:51
合計ジャッジ時間 3,435 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 1 ms
4,380 KB
testcase_14 AC 2 ms
4,376 KB
testcase_15 AC 1 ms
4,376 KB
testcase_16 AC 1 ms
4,380 KB
testcase_17 AC 1 ms
4,376 KB
testcase_18 AC 1 ms
4,380 KB
testcase_19 AC 1 ms
4,376 KB
testcase_20 AC 1 ms
4,380 KB
testcase_21 AC 2 ms
4,380 KB
testcase_22 AC 2 ms
4,376 KB
testcase_23 AC 1 ms
4,380 KB
testcase_24 AC 2 ms
4,380 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 1 ms
4,380 KB
testcase_28 AC 1 ms
4,380 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 AC 2 ms
4,376 KB
testcase_33 WA -
testcase_34 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:26:34: warning: ‘m’ may be used uninitialized in this function [-Wmaybe-uninitialized]
     if (s[3] == '-') {h *= -1; m *= -1;}
                                ~~^~~~~
main.cpp:26:25: warning: ‘h’ may be used uninitialized in this function [-Wmaybe-uninitialized]
     if (s[3] == '-') {h *= -1; m *= -1;}
                       ~~^~~~~

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);

    int a,b;
    string s;
    
    cin >> a >> b >> s;

    string t = s.substr(4);

    int h,m;
    bool flag = false;
    
    for (int i = 0;i < t.size();i++){
        if (i == 0) h = t[i] - '0';
        else if (t[i] == '.') flag = true;
        else if (flag) m = (t[i] - '0') * 6;
        else {h *= 10;h += t[i] - '0';}
    }

    if (s[3] == '-') {h *= -1; m *= -1;}

    a += h - 9;
    b += m;

    if (b >= 60) {
        a += b/60;
        b %= 60;
    }
    if (b < 0) {
        a += b/60 - 1;
        b += 60*(-b/60 + 1);
    }
    if (a >= 24) {
        a = a-24;
    }
    if (a < 0) a += 24;

    if (a < 10) cout << '0' << a << ':' ;
    else cout << a << ':' ;
    if (b < 10) cout << '0' << b << endl;
    else cout << b << endl;

    return 0;

}
0