結果

問題 No.269 見栄っ張りの募金活動
ユーザー atudnatudn
提出日時 2022-11-05 17:26:03
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 25 ms / 5,000 ms
コード長 1,182 bytes
コンパイル時間 2,249 ms
コンパイル使用メモリ 168,576 KB
実行使用メモリ 19,376 KB
最終ジャッジ日時 2023-09-26 15:39:46
合計ジャッジ時間 3,891 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rep1(i,a,n) for(int i=(int)a;i<(int)n;++i)
#define fi first
#define se second
#define PI 3.14159265359
using namespace std;
using ll=long long;
using pii=pair<int,int>;
using pll=pair<long long,long long>;
using veci=vector<int>;
using vecii=vector<pair<int,int>>;
using vecll=vector<long long>;
using vecpll=vector<pair<long long,long long>>;
using vecs=vector<string>;
using vecb=vector<bool>;
using vecd=vector<double>;
template<class T> inline bool chmax(T& a,T b){if(a<b) {a=b;return true;} return false;}
template<class T> inline bool chmin(T& a,T b){if(a>b) {a=b;return true;} return false;}
 
constexpr int INF=1<<30;
//constexpr ll INF=1LL<<61;
//constexpr int MOD=1000000007;
constexpr ll MOD=1000000007;
//constexpr ll MOD=998244353;
//constexpr int LOG=62;


int main(){
	//ifstream in("input.txt");
  //cin.rdbuf(in.rdbuf());
	
	ll n,s,k;cin>>n>>s>>k;
	s-=n*(n-1)*k/2;
	if(s<0) {
		cout<<0<<endl;
		return 0;
	}
	vector<vecll> dp(s+1,vecll(n+1,0));
	rep(i,n+1) dp[0][i]=1;
	rep1(i,1,s+1) rep1(j,1,n+1){
		dp[i][j]=dp[i][j-1]+(i>=j?dp[i-j][j]:0);
		dp[i][j]%=MOD;
	}
	cout<<dp[s][n]<<endl;
}
0