結果
| 問題 | 
                            No.269 見栄っ張りの募金活動
                             | 
                    
| コンテスト | |
| ユーザー | 
                             leaf_b
                         | 
                    
| 提出日時 | 2019-09-19 00:15:54 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 10 ms / 5,000 ms | 
| コード長 | 889 bytes | 
| コンパイル時間 | 1,524 ms | 
| コンパイル使用メモリ | 166,464 KB | 
| 実行使用メモリ | 19,180 KB | 
| 最終ジャッジ日時 | 2024-07-18 00:15:57 | 
| 合計ジャッジ時間 | 2,474 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 22 | 
ソースコード
#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][20010];
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;
}
            
            
            
        
            
leaf_b