結果
| 問題 | 
                            No.652 E869120 and TimeZone
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2018-02-23 23:21:10 | 
| 言語 | C++11(廃止可能性あり)  (gcc 13.3.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 441 bytes | 
| コンパイル時間 | 462 ms | 
| コンパイル使用メモリ | 54,564 KB | 
| 実行使用メモリ | 6,824 KB | 
| 最終ジャッジ日時 | 2024-12-17 13:28:01 | 
| 合計ジャッジ時間 | 1,404 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 5 | 
| other | AC * 13 WA * 17 | 
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:8:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    8 |   scanf("%d %d UTC%c%lf", &a, &b, &pm, &d);
      |   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            
            ソースコード
#include <iostream>
using namespace std;
int main(){
  int a, b;
  double d;
  char pm;
  scanf("%d %d UTC%c%lf", &a, &b, &pm, &d);
  a = (a+-9)%24;
  int ansa, ansb;
  if(pm=='+'){
    ansa = (int)(a+(int)d+((d-(int)d)*60+b)/60+24)%24;
    ansb = (int)((d-(int)d)*60+b)%60;
  }else{
    ansa = (int)(a-(int)d-(-(d-(int)d)*60+b)/60+24)%24;
    ansb = (int)(-(d-(int)d)*60+b+60)%60;
  }
  printf("%02d:%02d\n", ansa, ansb);
  return 0;
}