結果
| 問題 | No.188 HAPPY DAY | 
| コンテスト | |
| ユーザー |  ryogom | 
| 提出日時 | 2019-04-11 08:33:54 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 1,030 bytes | 
| コンパイル時間 | 396 ms | 
| コンパイル使用メモリ | 53,112 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-07-18 05:06:39 | 
| 合計ジャッジ時間 | 746 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | WA * 1 | 
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:65:11: warning: ‘ans’ is used uninitialized [-Wuninitialized]
   65 |     cout<<ans<<endl;
      |           ^~~
            
            ソースコード
#include <iostream>
#include <string>
using namespace std;
int main() {
    int a=0;
    int b=1;
    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;
    
}
            
            
            
        