結果
| 問題 |
No.269 見栄っ張りの募金活動
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-10-10 23:34:31 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,037 bytes |
| コンパイル時間 | 812 ms |
| コンパイル使用メモリ | 101,036 KB |
| 最終ジャッジ日時 | 2025-02-17 06:42:25 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 WA * 1 |
ソースコード
/*
*/
#include<iostream>
#include<set>
#include<algorithm>
#include<vector>
#include<string>
#include<set>
#include<map>
#include<stack>
#include<numeric>
#include<queue>
#include<cmath>
#include<deque>
using namespace std;
typedef long long ll;
const ll INF=1LL<<60;
typedef pair<int,int> P;
typedef pair<ll,P> PP;
const ll MOD=1e9+7;
int main(){
ll N,S,K;
cin>>N>>S>>K;
S=S-K*N*(N-1)/2;
if(S<=0){
cout<<0<<endl;
return 0;
}
vector<vector<ll>> dp(S+1,vector<ll>(N+1,0));
dp[0][0]=1;//0個のものを0人で分け与える
/*
for(int k=0;k<=S;k++){
//k個の者を0個で分割
dp[k][0]=1;
}
*/
for(int i=0;i<=S;i++){
for(int j=1;j<=N;j++){
if(i-j>=0){
//i-j個の者をj個で分割
dp[i][j]+=dp[i-j][j];
dp[i][j]%=MOD;
}
//i個の者をj-1個で分割
dp[i][j]+=dp[i][j-1];
dp[i][j]%=MOD;
}
}
cout<<dp[S][N]<<endl;
}