結果
| 問題 | No.652 E869120 and TimeZone | 
| コンテスト | |
| ユーザー |  Bantako | 
| 提出日時 | 2018-05-29 19:22:55 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 2 ms / 1,000 ms | 
| コード長 | 738 bytes | 
| コンパイル時間 | 1,316 ms | 
| コンパイル使用メモリ | 168,324 KB | 
| 実行使用メモリ | 5,376 KB | 
| 最終ジャッジ日時 | 2024-06-11 12:25:05 | 
| 合計ジャッジ時間 | 2,181 ms | 
| ジャッジサーバーID (参考情報) | judge3 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 5 | 
| other | AC * 30 | 
コンパイルメッセージ
main.cpp:21:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   21 | main(){
      | ^~~~
            
            ソースコード
#include<bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using namespace std;
typedef long long ll;
int INF = (1LL << 30) - 1;
int MOD = 1e9+7;
int parse(string S){
    int num = 0;
    bool flag = 0;
    for(auto c:S){
        if(c == '.')flag = 1;
        else if(flag){
            num += (c - '0') * 6;
        }else{
            num *= 10;
            num += (c - '0') * 60;
        }
    }
    return num;
}
main(){
    int a,b;
    string S;
    cin >> a >> b >> S;
    int time = a * 60 + b;
    //int dif = (int)(stof(S.substr(3) ) * 60);
    int dif = parse(S.substr(4));
    if(S[3] == '-')dif *= -1;
    time += dif - 60*9;
    time = (time + 60*24) % (60*24);
    printf("%02d:%02d\n" ,time/60 ,time%60);
}
            
            
            
        