結果

問題 No.188 HAPPY DAY
コンテスト
ユーザー ut0s
提出日時 2019-09-04 22:48:26
言語 C++14
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=c++14 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 1 ms / 1,000 ms
コード長 679 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,040 ms
コンパイル使用メモリ 183,356 KB
実行使用メモリ 6,400 KB
最終ジャッジ日時 2026-06-03 16:47:52
合計ジャッジ時間 1,831 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge2_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 1
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

/**
  @file 188.cpp
  @title  No.188 HAPPY DAY - yukicoder
  @url https://yukicoder.me/problems/no/188
**/

#include <bits/stdc++.h>
using namespace std;

typedef long long LL;
#define ALL(obj) (obj).begin(), (obj).end()
#define REP(i, N) for (int i = 0; i < (N); ++i)

int main() {
  vector<int> days = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

  int ans = 0;
  for (int month = 0; month < 12; month++) {
    for (int day = 1; day <= days[month]; day++) {
      int y = 0;
      REP(j, (int)to_string(day).size()) {
        y += stoi(to_string(day).substr(j, 1));
      }
      if (month+1 == y) {
        ans++;
      }
    }
  }

  cout << ans << endl;
  return 0;
}
0