結果
| 問題 | No.652 E869120 and TimeZone | 
| コンテスト | |
| ユーザー |  focus | 
| 提出日時 | 2018-02-28 18:52:52 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 2 ms / 1,000 ms | 
| コード長 | 770 bytes | 
| コンパイル時間 | 591 ms | 
| コンパイル使用メモリ | 75,856 KB | 
| 実行使用メモリ | 5,376 KB | 
| 最終ジャッジ日時 | 2024-06-11 12:23:26 | 
| 合計ジャッジ時間 | 1,468 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 5 | 
| other | AC * 30 | 
ソースコード
#include<iostream>
#include<vector>
#include<bitset>
#include<algorithm>
#include<cmath>
#include<string>
using namespace std;
int main(){ 
    int hour,time,n;
    float num;
    string str,nstr;
    cin >> hour >> time >> str;
    for(int i=4;i<=str.size();i++){
        nstr[i-4] = str[i];
    }
    num = stof(nstr);
    if(str[3]=='-') num*=(-1);
    num*=10;
    n = floor(num);
    n-=90;
    n*=6;
    time+=n;
    while(time<0){
        time+=60;
        hour--;
    }
    while(time>=60){
        time-=60;
        hour++;
    }
    if(hour<0)  hour+=24;
    else if(hour>=24)   hour-=24;
    if(hour<10) cout << '0' << hour;
    else cout << hour;
    cout << ':' ;
    if(time<10) cout << '0' << time << endl;
    else cout << time << endl;
    return 0;
}
            
            
            
        