結果
| 問題 | No.269 見栄っ張りの募金活動 |
| コンテスト | |
| ユーザー |
mahala_coder
|
| 提出日時 | 2020-01-25 00:39:45 |
| 言語 | C++14 (gcc 15.3.0 + boost 1.92.0) |
| 結果 |
AC
|
| 実行時間 | 15 ms / 5,000 ms |
| + 458µs | |
| コード長 | 479 bytes |
| 記録 | |
| コンパイル時間 | 1,038 ms |
| コンパイル使用メモリ | 183,660 KB |
| 実行使用メモリ | 19,712 KB |
| 最終ジャッジ日時 | 2026-08-26 19:18:08 |
| 合計ジャッジ時間 | 2,689 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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