結果

問題 No.269 見栄っ張りの募金活動
ユーザー ishizuishizu
提出日時 2015-08-21 23:26:48
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 10 ms / 5,000 ms
コード長 1,211 bytes
コンパイル時間 511 ms
コンパイル使用メモリ 70,332 KB
実行使用メモリ 19,068 KB
最終ジャッジ日時 2023-09-23 01:05:27
合計ジャッジ時間 1,544 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 4 ms
11,680 KB
testcase_04 AC 5 ms
9,260 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 4 ms
15,744 KB
testcase_07 AC 10 ms
19,068 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 3 ms
4,608 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 4 ms
8,460 KB
testcase_14 AC 2 ms
4,376 KB
testcase_15 AC 3 ms
6,488 KB
testcase_16 AC 2 ms
4,376 KB
testcase_17 AC 1 ms
4,376 KB
testcase_18 AC 6 ms
14,668 KB
testcase_19 AC 3 ms
8,132 KB
testcase_20 AC 2 ms
4,376 KB
testcase_21 AC 2 ms
4,380 KB
testcase_22 AC 3 ms
6,016 KB
testcase_23 AC 3 ms
5,736 KB
testcase_24 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<cstdio>
#include<vector>
#include<queue>

#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<functional>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define INF 1<<30
#define MP make_pair
#define mp make_pair
#define pb push_back
#define PB push_back
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define ll long long
#define ull unsigned long long
const ll MOD=1e9+7;

ll mpow(ll r,ll n, ll m){
    if(n==0) return 1;
    if(n==1) return r;
    ll res=mpow(r,n/2,m);
    res=(res*res)%m;
    if(n&1) res=(res*r)%m;
    return res;
}
ll m_inv(ll r,ll m){
    return mpow(r,m-2,m);
}

ll nck(ll n,ll k){
	ll a=1,b=1;
	REP(i,k){
		(a*=n-i)%=MOD;
		(b*=i+1)&=MOD;
	}
	return a*m_inv(b,MOD)%MOD;
}
ll dp[101][20010];
int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n,s,k;cin>>n>>s>>k;
	s -= (n-1)*n/2*k;
	if(s<0){ cout<<0<<endl; return 0;}
	dp[0][0]=1;
	FOR(i,1,n+1){
		FOR(j,0,s+1){
			if(j-i>=0) dp[i][j]=(dp[i-1][j]+dp[i][j-i])%MOD;
			else dp[i][j]=dp[i-1][j];
		}
	}
	cout<<dp[n][s]<<endl;
	 

}
0