結果

問題 No.188 HAPPY DAY
ユーザー r2en_
提出日時 2017-02-27 01:22:51
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 650 bytes
コンパイル時間 677 ms
コンパイル使用メモリ 54,672 KB
実行使用メモリ 6,816 KB
最終ジャッジ日時 2024-12-31 01:22:52
合計ジャッジ時間 746 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
using namespace std;

int calc(int x,int y){
    int sum = 0;
    sum = y/10 + y%10;
    if(x == sum){
        return 1;
    }
    return 0;
}

int main(void){
    int x,y;
    int count = 0;
    for(x=1;x<=12;x++){
        if(x==2){
            for(y=1;y<=29;y++){
                if(calc(x,y) == 1){count++;}
            }
        }else if(x==4 || x==6 || x==9 || x==11){
            for(y=1;y<=30;y++){
                if(calc(x,y) == 1){count++;}
            }
        }else{
            for(y=1;y<=31;y++){
                if(calc(x,y) == 1){count++;}
            }
        }
    }
    cout << count << "\n";
    return(0);
}
0