結果

問題 No.188 HAPPY DAY
コンテスト
ユーザー ryogom
提出日時 2019-04-11 08:33:54
言語 C++11
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=gnu++11 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
MLE  
実行時間 -
コード長 1,030 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 297 ms
コンパイル使用メモリ 70,232 KB
実行使用メモリ 78,076 KB
最終ジャッジ日時 2026-04-01 20:59:11
合計ジャッジ時間 600 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other MLE * 1
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:65:11: warning: 'ans' is used uninitialized [-Wuninitialized]
   65 |     cout<<ans<<endl;
      |           ^~~
main.cpp:11:9: note: 'ans' was declared here
   11 |     int ans;
      |         ^~~

ソースコード

diff #
raw source code

#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;
    
}
0