結果

問題 No.188 HAPPY DAY
ユーザー BantakoBantako
提出日時 2017-06-24 13:05:26
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 569 bytes
コンパイル時間 156 ms
コンパイル使用メモリ 25,536 KB
実行使用メモリ 4,376 KB
最終ジャッジ日時 2023-08-29 22:36:44
合計ジャッジ時間 654 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:2:6: warning: ISO C++ forbids declaration of ‘main’ with no type [-Wreturn-type]
 main(){
      ^

ソースコード

diff #

#include<stdio.h>
main(){
    int count = 0;
    int maxd[] = {31,28,31,30,31,30,31,31,30,31,30,31};
    //1~9month
    //0nday,1(n-1)day,2(n-2)day,3(n-3)dayが存在する
    for(int i = 1;i <= 9;i++){
        for(int j = 0;j < 4;j++){
            if(i-j >= 0 && j*10 + (i-j) <= maxd[i-1]){
                count++;
            }
        }
    }
    //10~12month
    for(int i = 10;i <= 12;i++){
        for(int j = 1;j < 4;j++){
            if(i-j < 10 && j*10 + (i-j) <= maxd[i-1]){
                count++;
            }
        }
    }
    printf("%d\n",count);
}
0