結果

問題 No.1229 ラグビーの得点パターン
ユーザー kpinkcat
提出日時 2023-07-23 18:31:47
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 473 bytes
コンパイル時間 928 ms
コンパイル使用メモリ 102,832 KB
最終ジャッジ日時 2025-02-15 18:35:55
ジャッジサーバーID
(参考情報)
judge4 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 4
other WA * 25
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:22:42: warning: ‘cnt’ may be used uninitialized [-Wmaybe-uninitialized]
   22 |             if (!(r1%2) && r1/2 <= t) cnt++;
      |                                       ~~~^~
main.cpp:15:25: note: ‘cnt’ was declared here
   15 |     int n, t, c, r, r1, cnt;
      |                         ^~~

ソースコード

diff #

#include<iostream>
#include<string>
#include<algorithm>
#include<cctype>
#include<set>
#include<bitset>
#include<math.h>
#include<map>
#include<queue>
#include<iomanip>
using namespace std;


int main(){
    int n, t, c, r, r1, cnt;
    cin >> n;
    for (int i = 0; i <= n/5; i++){
        t = i;
        r = n - i*5;
        for (int j = 0; j <= r/3; j++){
            r1 = r - j*3;
            if (!(r1%2) && r1/2 <= t) cnt++;
        }
    }
    cout << cnt << endl;
}
0