結果
| 問題 |
No.269 見栄っ張りの募金活動
|
| コンテスト | |
| ユーザー |
umezo
|
| 提出日時 | 2023-12-14 03:45:35 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 20 ms / 5,000 ms |
| コード長 | 528 bytes |
| コンパイル時間 | 1,846 ms |
| コンパイル使用メモリ | 191,856 KB |
| 最終ジャッジ日時 | 2025-02-18 10:52:34 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 22 |
ソースコード
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(v) v.begin(), v.end()
typedef long long ll;
#include <bits/stdc++.h>
using namespace std;
const int MOD=1e9+7;
ll dp[20202][110];
int main(){
int n,s,k;
cin>>n>>s>>k;
if(s-(n-1)*n*k/2<0){
cout<<0<<endl;
return 0;
}
dp[0][0]=1;
for(int i=0;i<=s-(n-1)*n*k/2;i++){
for(int j=1;j<=n;j++){
if(i>=j) dp[i][j]=(dp[i-j][j]+dp[i][j-1])%MOD;
else dp[i][j]=dp[i][j-1];
}
}
cout<<dp[s-(n-1)*n*k/2][n]<<endl;
return 0;
}
umezo