結果
| 問題 | No.525 二度寝の季節 | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2018-05-01 15:44:53 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 2 ms / 1,000 ms | 
| コード長 | 567 bytes | 
| コンパイル時間 | 746 ms | 
| コンパイル使用メモリ | 65,428 KB | 
| 実行使用メモリ | 5,376 KB | 
| 最終ジャッジ日時 | 2024-06-28 00:12:01 | 
| 合計ジャッジ時間 | 1,818 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 33 | 
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:19:7: warning: ‘h’ may be used uninitialized [-Wmaybe-uninitialized]
   19 |     h += (T.at(i) - '0') * pow(10, (1-i));
      |     ~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
main.cpp:22:7: warning: ‘m’ may be used uninitialized [-Wmaybe-uninitialized]
   22 |     m += (T.at(i+3) - '0') * pow(10, (1-i));
      |     ~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            
            ソースコード
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;
int main() {
  std::cin.tie(0);
  std::ios::sync_with_stdio(false);
  string T;
  cin >> T;
  int h, m;
  for(int i=0;i<2;i++){
    h += (T.at(i) - '0') * pow(10, (1-i));
  }
  for(int i=0;i<2;i++){
    m += (T.at(i+3) - '0') * pow(10, (1-i));
  }
  int ans = 60 * h + m + 5;
  ans %= 24*60;
  int ah = ans / 60;
  int am = ans % 60;
  if(ah < 10)
    cout << "0";
  cout << ah;
  cout << ":";
  if(am < 10)
    cout << "0";
  cout << am << endl;
  return 0;
}
            
            
            
        