結果
| 問題 | 
                            No.269 見栄っ張りの募金活動
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2016-01-30 01:17:56 | 
| 言語 | C++11(廃止可能性あり)  (gcc 13.3.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 6 ms / 5,000 ms | 
| コード長 | 860 bytes | 
| コンパイル時間 | 921 ms | 
| コンパイル使用メモリ | 91,808 KB | 
| 実行使用メモリ | 6,944 KB | 
| 最終ジャッジ日時 | 2024-07-16 01:52:29 | 
| 合計ジャッジ時間 | 1,799 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge1 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 22 | 
ソースコード
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
using namespace std;
const int MOD = 1000000007;
int main()
{
    int n, s, d;
    cin >> n >> s >> d;
    s -= n * (n - 1) / 2 * d;
    if(s < 0){
        cout << 0 << endl;
        return 0;
    }
    vector<int> dp(s+1, 0);
    dp[0] = 1;
    for(int i=0; i<n; ++i){
        for(int j=0; j<=s; ++j){
            int a = j + (n - i);
            if(s < a)
                break;
            dp[a] += dp[j];
            dp[a] %= MOD;
        }
    }
    cout << dp[s] << endl;
    return 0;
}