結果

問題 No.269 見栄っ張りの募金活動
ユーザー 158b158b
提出日時 2021-07-03 21:03:41
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 1,625 bytes
コンパイル時間 3,113 ms
コンパイル使用メモリ 159,200 KB
実行使用メモリ 12,104 KB
最終ジャッジ日時 2023-09-13 02:36:34
合計ジャッジ時間 5,365 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 RE -
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 11 ms
11,380 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 14 ms
12,104 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 RE -
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 10 ms
10,368 KB
testcase_12 RE -
testcase_13 AC 7 ms
7,224 KB
testcase_14 AC 12 ms
12,032 KB
testcase_15 AC 8 ms
8,192 KB
testcase_16 RE -
testcase_17 RE -
testcase_18 AC 8 ms
9,484 KB
testcase_19 AC 5 ms
7,444 KB
testcase_20 AC 5 ms
6,244 KB
testcase_21 AC 10 ms
10,532 KB
testcase_22 AC 5 ms
5,696 KB
testcase_23 AC 2 ms
4,380 KB
testcase_24 AC 8 ms
8,184 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <climits>
#include <vector>
#include <numeric>
#include <complex>
#include <map>
#include <bitset>
#include <stack>
#include <queue>
#include <set>
#include <iomanip>
#include <cmath>
#include <atcoder/all>
using namespace std;
using namespace atcoder;

//#define __int64 long long
//#define long __int64
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
const int Vec = 4;
const int Vecy[Vec] = {0,-1,0,1};
const int Vecx[Vec] = {1,0,-1,0};
const int Modd = 1000000007;


int n,s,k;
int dp[20010][110];
int dpBox, dpBall;

void print2D(int a[][110]){
    rep(i,dpBall+1){
        rep(j,dpBox+1){
            cout << dp[i][j] << " ";
        }
        cout << endl;
    }
}

int main(){
    cin >> n >> s >> k;

    dpBall = s - (n * (n+1) / 2 - n) * k;
    dpBox =  n;
    // cout << "dpBall:" << dpBall << endl;
    /*
    rep(i, dpBall+1){
        dp[i][0] = 1;
    }
    rep(i, dpBox+1){
        dp[0][i] = 1;
    }
    */
   dp[0][0] = 1;

    //print2D(dp);

    for(int balli=0; balli<=dpBall; balli++){
        for(int boxi=1; boxi<=dpBox; boxi++){
            // dp[balli][boxi] = dp[balli][boxi-1] + dp[max(0, balli-boxi)][boxi];
            // dp[balli][boxi] %= Modd;

            if(balli-boxi >= 0){
                dp[balli][boxi] = dp[balli][boxi-1] + dp[max(0, balli-boxi)][boxi];
                dp[balli][boxi] %= Modd;
            }else{
                dp[balli][boxi] = dp[balli][boxi-1];
            }
        }
    }

    //print2D(dp);

    cout << dp[dpBall][dpBox] << endl;

    return 0;
}
0