結果

問題 No.652 E869120 and TimeZone
ユーザー face4
提出日時 2018-04-29 22:59:59
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 388 bytes
コンパイル時間 400 ms
コンパイル使用メモリ 55,152 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-27 23:42:59
合計ジャッジ時間 1,419 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 5
other AC * 28 WA * 2
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:7:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    7 |     scanf("%d %d UTC%lf", &a, &b, &utc);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include<iostream>
using namespace std;

int main(){
    int a, b;
    double utc;
    scanf("%d %d UTC%lf", &a, &b, &utc);
    utc = utc - 9.0;
    int now = a*60 + b;
    now += utc*60;
    while(now < 0){
        now += 60*24;
    }
    now %= (60*24);
    a = now/60;
    b = now - 60*a;
    cout << (a < 10 ? "0" : "") << a << ":" << (b < 10 ? "0" : "") << b << endl;
    return 0;
}
0