結果
問題 | No.188 HAPPY DAY |
ユーザー | zawakasu |
提出日時 | 2022-04-18 17:10:38 |
言語 | C++11 (gcc 11.4.0) |
結果 |
AC
|
実行時間 | 1 ms / 1,000 ms |
コード長 | 1,661 bytes |
コンパイル時間 | 1,895 ms |
コンパイル使用メモリ | 160,652 KB |
実行使用メモリ | 6,812 KB |
最終ジャッジ日時 | 2024-06-09 08:37:16 |
合計ジャッジ時間 | 1,581 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ソースコード
#include <bits/stdc++.h> // clang-format off using namespace std; #define all(a) a.begin(), a.end() #define int long long #define over_load_(_1, _2, _3, _4, NAME, ...) NAME #define rep(...) over_load_(__VA_ARGS__, rep4, rep3, rep2)(__VA_ARGS__) #define rep2(i, r) for (int i = 0; i < static_cast<int>(r); (i) += 1) #define rep3(i, l, r) for (int i = static_cast<int>(l); i < static_cast<int>(r); (i) += 1) #define rep4(i, l, r, stride) for (int i = static_cast<int>(l); i < static_cast<int>(r); (i) += (stride)) #define rrep(...) over_load_(__VA_ARGS__, rrep4, rrep3, rrep2)(__VA_ARGS__) #define rrep2(i, r) for (int i = static_cast<int>(r) - 1; i >= 0; (i) -= 1) #define rrep3(i, l, r) for (int i = static_cast<int>(r) - 1; i >= static_cast<int>(l); (i) -= 1) #define rrep4(i, l, r, stride) for (int i = static_cast<int>(r) - 1; i >= static_cast<int>(l); (i) -= (stride)) #define fore(i, a) for (auto &i : a) template <typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { return a < b and (a = b, true); } template <typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { return a > b and (a = b, true); } constexpr char newl = '\n'; using ll = long long; using vi = vector<int>; using vll = vector<ll>; using vvi = vector<vi>; using vvll = vector<vll>; using vp = vector<pair<int, int>>; using vs = vector<string>; vi calendar = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; bool judge(int m, int d) { int sum = 0; while(d > 0) { sum += d % 10; d /= 10; } return sum == m; } signed main() { int ans = 0; rep(i, 12) rep(j, 1, calendar[i] + 1) ans += judge(i + 1, j); cout << ans << newl; }