結果

問題 No.525 二度寝の季節
ユーザー cww
提出日時 2017-10-10 01:58:50
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 837 bytes
コンパイル時間 2,051 ms
コンパイル使用メモリ 195,644 KB
最終ジャッジ日時 2025-01-05 03:12:40
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 33
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
int main()
{
    string H, M;
    REP( i, 5 )
    {
        char T;
        cin >> T;
        if( i == 2 ) continue;
        i <= 1 ? H += T : M += T;
    }
    int h = stoi( H );
    int m = stoi( M );
    int m_res{ m + 5 }, h_res{ h };
    if( m_res >= 60 )
    {
        m_res = ( m + 5 ) % 60;
        h_res++;
    }
    if( h > 24 )
    {
        h_res = h_res % 24;
    }
    string hh = to_string( h_res );
    string mm = to_string( m_res );
    cout << ( h_res == 24 ? "00" : hh.size() == 1 ? "0" + hh : hh ) << ":" << ( m_res == 60 ? "00" : mm.size() == 1 ? "0" + mm : mm ) << endl;
    return 0;
}
0