結果
| 問題 | No.188 HAPPY DAY | 
| コンテスト | |
| ユーザー |  tetsuzuki1115 | 
| 提出日時 | 2017-09-26 21:33:18 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 2 ms / 1,000 ms | 
| コード長 | 819 bytes | 
| コンパイル時間 | 685 ms | 
| コンパイル使用メモリ | 79,280 KB | 
| 実行使用メモリ | 6,816 KB | 
| 最終ジャッジ日時 | 2024-12-31 05:59:29 | 
| 合計ジャッジ時間 | 1,066 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 1 | 
ソースコード
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <math.h>
#include <cmath>
#include <limits.h>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <functional>
#include <stdio.h>
using namespace std;
long long MOD = 1000000007;
int main() {
    
    int happy = 0;
    int x[4] = { 4,6,9,11 };
    
    for ( int m = 1; m <= 12; m++ ) {
        
        int D = m == 2 ? 28 : m == 4 || m == 6 || m == 9 || m == 11 ? 30 : 31;
        for ( int d = 1; d <= D; d++ ) {
            
            int x = 0;
            for ( int i = 0; i < to_string(d).length(); i++ ) {
                x += to_string(d)[i] - '0';
            }
            
            if ( x == m ) { happy++; }
            
        }
    }
    
    cout << happy << endl;
    
    return 0;
}
            
            
            
        