結果
問題 |
No.269 見栄っ張りの募金活動
|
ユーザー |
![]() |
提出日時 | 2019-09-19 00:14:38 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 889 bytes |
コンパイル時間 | 1,535 ms |
コンパイル使用メモリ | 165,792 KB |
実行使用メモリ | 19,072 KB |
最終ジャッジ日時 | 2024-07-18 00:14:29 |
合計ジャッジ時間 | 2,578 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 WA * 1 |
ソースコード
#include <bits/stdc++.h> #define int long long #define REP( i, n ) for( int (i) = 0; (i) < (n); (i)++ ) #define ALL( a ) (a).begin(), (a).end() #define MP make_pair using namespace std; using P = pair<int, int>; template<class T>bool chmax( T& a, const T& b ) { if( a < b ) { a = b; return 1; } return 0; } template<class T>bool chmin( T& a, const T& b ) { if( a > b ) { a = b; return 1; } return 0; } const int INF = 1e18; const int MOD = 1e9 + 7; int dp[110][20000]; signed main(){ int N, S, K; cin >> N >> S >> K; S -= N * ( N - 1 ) * K / 2; dp[0][0] = 1; for( int i = 1; i <= N; i++ ){ REP( j, S + 1 ){ if( i <= j ){ 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; }