結果

問題 No.525 二度寝の季節
ユーザー Noiri
提出日時 2017-12-05 13:03:54
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 810 bytes
コンパイル時間 431 ms
コンパイル使用メモリ 58,516 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-28 16:33:18
合計ジャッジ時間 1,437 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 33
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
using namespace std;

int main(){
    string t; cin >> t;
    string temp;
    string h;
    string m;

    //まずは:を除いたstring型を成形
    temp = t[0];
    h = temp;
    temp = t[1];
    h += temp;

    temp = t[3];
    m = temp;
    temp = t[4];
    m += temp;

    //整数に変換
    int min, hour;
    min = stoi(m);
    hour = stoi(h);

    min += 5;
    if(min >= 60){
        min = min-60;
        hour += 1;
        if(hour >= 24){
            hour = 0;
        }
    }

    if(min < 10 && hour < 10) cout << "0" << hour << ":" << "0" << min << endl;
    else if(min < 10) cout << hour << ":" << "0" << min << endl;
    else if(hour < 10) cout << "0" << hour << ":" << min << endl;
    else cout << hour << ":" << min << endl;

    return 0;
}
0