結果

問題 No.525 二度寝の季節
コンテスト
ユーザー Toshihiko Yanase
提出日時 2018-05-01 15:44:53
言語 C++11
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=gnu++11 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 567 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 520 ms
コンパイル使用メモリ 89,040 KB
実行使用メモリ 6,272 KB
最終ジャッジ日時 2026-03-16 07:21:45
合計ジャッジ時間 1,717 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 2
other WA * 33
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:22:7: warning: 'm' may be used uninitialized [-Wmaybe-uninitialized]
   22 |     m += (T.at(i+3) - '0') * pow(10, (1-i));
      |     ~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
main.cpp:16:10: note: 'm' was declared here
   16 |   int h, m;
      |          ^
main.cpp:19:7: warning: 'h' may be used uninitialized [-Wmaybe-uninitialized]
   19 |     h += (T.at(i) - '0') * pow(10, (1-i));
      |     ~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
main.cpp:16:7: note: 'h' was declared here
   16 |   int h, m;
      |       ^

ソースコード

diff #
raw source code

#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;
}
0