結果

問題 No.188 HAPPY DAY
ユーザー route_atmroute_atm
提出日時 2015-11-10 16:04:53
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 1 ms / 1,000 ms
コード長 404 bytes
コンパイル時間 1,017 ms
コンパイル使用メモリ 51,360 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-29 03:30:55
合計ジャッジ時間 1,481 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:19:7: warning: ‘D’ may be used uninitialized in this function [-Wmaybe-uninitialized]
       if (month == D) ans++;
       ^~

ソースコード

diff #

#include <iostream>
using namespace std;

int main()
{
  int days[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
  int ans = 0;
  int D;

  for (int m = 0; m < 12; m++)
  {
    int month = m + 1;
    for (int day = 1; day <= days[m]; day++)
    {
      if (day >= 10)
      {
        D = (day / 10) + (day % 10);
      }
      if (month == D) ans++;
    }
  }
  cout << ans << endl;
  return 0;
}
0