結果

問題 No.188 HAPPY DAY
ユーザー ryogomryogom
提出日時 2019-04-11 08:33:18
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,030 bytes
コンパイル時間 362 ms
コンパイル使用メモリ 50,408 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-25 05:58:35
合計ジャッジ時間 770 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:65:11: warning: ‘ans’ is used uninitialized in this function [-Wuninitialized]
     cout<<ans<<endl;
           ^~~

ソースコード

diff #

#include <iostream>
#include <string>

using namespace std;

int main() {
    int a=1;
    int b=0;
    int i;
    int date=0;
    int ans;
for(i=1;i==12;i++){
    switch (i){
        case 2:
        
        for(b=1; date<29;b++){
            if(b==10){
                a++;
                b=0;
            }
        date=10*a+b;
        if(a+b==i){
        ans++;
        }
        a=1;
        b=0;
        }
        break;
        case 4:
        case 6:
        case 9:
        case 11:
        for(b=1; date<31;b++){
            if(b==10){
                a++;
                b=0;
            }
        date=10*a+b;
        if(a+b==i){
        ans++;
        }        
        a=1;
        b=0;
        }
        break;
        default:
        for(b=1; date<32;b++){
            if(b==10){
                a++;
                b=0;
            }
        date=10*a+b;
        if(a+b==i){
        ans++;
        }
        a=1;
        b=0;
        }
        break;
    }    
    
    
}    
    
    cout<<ans<<endl;
    
}
0