結果
問題 | No.269 見栄っ張りの募金活動 |
ユーザー |
|
提出日時 | 2019-10-11 18:58:06 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 71 ms / 5,000 ms |
コード長 | 937 bytes |
コンパイル時間 | 1,516 ms |
コンパイル使用メモリ | 171,652 KB |
実行使用メモリ | 21,248 KB |
最終ジャッジ日時 | 2024-11-25 01:34:31 |
合計ジャッジ時間 | 3,821 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 22 |
ソースコード
#include<bits/stdc++.h>#define EM 1000000using namespace std;using LL = long long;using P = pair<LL, LL>;LL LINF = 1e18;int INF = 1e9;LL mod = 1e9+7;using vint = vector<int>;using vLL = vector<LL>;using vvint = vector<vector<int>>;using vvLL = vector<vector<LL>>;template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }vector<vector<LL>> dp(20010, vector<LL>(110, 0));int main(){int N, S, K;cin >> N >> S >> K;S -= N*(N-1)/2*K;if(S < 0){cout << 0 << endl;return 0;}for(int i = 0;i < 20010;i++) dp[i][1] = 1;for(int n = 2;n < 110;n++){for(int s = 0;s < 20010;s++){dp[s][n] += dp[s][n-1];if(s-n >= 0) dp[s][n] += dp[s-n][n];dp[s][n] %= mod;}}cout << dp[S][N] << endl;}