結果
| 問題 | No.188 HAPPY DAY | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2016-03-23 14:39:12 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 582 bytes | 
| コンパイル時間 | 725 ms | 
| コンパイル使用メモリ | 55,160 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-12-30 21:16:09 | 
| 合計ジャッジ時間 | 1,071 ms | 
| ジャッジサーバーID (参考情報) | judge4 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | WA * 1 | 
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:13:16: warning: ‘answer’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   13 |         answer += func((i+1), days.at(i));
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
            
            ソースコード
#include <iostream>
#include <array>
using namespace std;
int func(unsigned int a, unsigned int b);
int main() {
    array<int, 12> days {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
    int answer;
    for ( unsigned int i = 0; i < days.size(); ++i ) {
        answer += func((i+1), days.at(i));
    }
    cout << answer << endl;
    return 0;
}
int func(unsigned int a, unsigned int b) {
    int happyDays = 0;
    for ( unsigned int j = 1; j <= b; ++j) {
        unsigned int c = ( j / 10) + ( j % 10);
        if ( a == c ) ++happyDays;
    }
    return happyDays;
}
            
            
            
        