結果

問題 No.188 HAPPY DAY
ユーザー ut0sut0s
提出日時 2019-09-04 22:48:26
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 1 ms / 1,000 ms
コード長 679 bytes
コンパイル時間 1,552 ms
コンパイル使用メモリ 167,624 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-28 17:15:18
合計ジャッジ時間 1,771 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

/**
  @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