結果

問題 No.188 HAPPY DAY
ユーザー boutarouboutarou
提出日時 2020-08-02 11:09:34
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 1 ms / 1,000 ms
コード長 605 bytes
コンパイル時間 1,463 ms
コンパイル使用メモリ 164,720 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-25 11:28:27
合計ジャッジ時間 1,850 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

/**
*    author:  boutarou
*    created: 02.08.2020 11:05:43
**/

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < int(n); i++)
using ll = long long;
using P = pair<int, int>;

int digit(int x) {
    int res = 0;
    while (x > 0) {
        res += x % 10;
        x /= 10;
    }
    return res;
}

int month[] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

int main() {
    int cnt = 0;
    for (int i = 1; i <= 12; i++) {
        for (int j = 1; j <= month[i]; j++) {
            if (i == digit(j)) cnt++;
        }
    }
    cout << cnt << endl;
    return 0;
}
0