結果

問題 No.269 見栄っ張りの募金活動
ユーザー motmot
提出日時 2020-05-25 22:53:58
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 10 ms / 5,000 ms
コード長 1,020 bytes
コンパイル時間 1,014 ms
コンパイル使用メモリ 81,952 KB
実行使用メモリ 18,988 KB
最終ジャッジ日時 2024-04-21 03:57:44
合計ジャッジ時間 1,700 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 3 ms
5,376 KB
testcase_04 AC 4 ms
8,960 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 10 ms
18,988 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 1 ms
5,376 KB
testcase_13 AC 3 ms
5,376 KB
testcase_14 AC 2 ms
5,376 KB
testcase_15 AC 2 ms
5,376 KB
testcase_16 AC 2 ms
5,376 KB
testcase_17 AC 1 ms
5,376 KB
testcase_18 AC 6 ms
9,088 KB
testcase_19 AC 3 ms
5,376 KB
testcase_20 AC 2 ms
5,376 KB
testcase_21 AC 2 ms
5,376 KB
testcase_22 AC 3 ms
5,376 KB
testcase_23 AC 2 ms
5,376 KB
testcase_24 AC 2 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define rep(i, n) for(int i=0;i<n;++i)
#define rrep(i, n) for(int i=n;i>=0;--i)
const int inf=1e9+7;
const ll mod=1e9+7;
const ll big=1e18;
const double PI=2*asin(1);

ll DP[105][20005];

int main() {
    ll N, S, K;
    cin>>N>>S>>K;
    S -= (N-1)*N/2*K;
    if(S<0) cout<<0<<endl;
    else {
        for(int i=0;i<=S;++i){
            DP[1][i] = 1;
        }
        for(int i=1;i<=N;++i){
            DP[i][0] = 1;
        }
        for(int i=1;i<=N;++i){
            for(int j=1;j<=S;++j){
                if(j>=i){
                    DP[i][j] = DP[i][j-i] + DP[i-1][j];
                    DP[i][j] %= mod;
                }
                else DP[i][j] = DP[i-1][j];
            }
        }
        cout<<DP[N][S]<<endl;
    }
}

0