結果
| 問題 |
No.269 見栄っ張りの募金活動
|
| コンテスト | |
| ユーザー |
mahala_coder
|
| 提出日時 | 2020-01-25 00:39:45 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 38 ms / 5,000 ms |
| コード長 | 479 bytes |
| コンパイル時間 | 1,720 ms |
| コンパイル使用メモリ | 170,892 KB |
| 実行使用メモリ | 19,584 KB |
| 最終ジャッジ日時 | 2024-09-14 03:58:20 |
| 合計ジャッジ時間 | 2,713 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 22 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll mod=1e9+7;
int main() {
ll n,s,k;
cin >> n >> s >> k;
s-=n*(n-1)*k/2;
if(s<0) {
cout << 0 << endl;
return 0;
}
vector<vector<ll>> dp(n+1,vector<ll>(s+1,0));
dp[0][0]=1;
for(int i=1;i<=n;i++) {
for(int j=0;j<=s;j++) {
if(j-i>-1) {
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;
}
mahala_coder