結果

問題 No.269 見栄っ張りの募金活動
ユーザー mamekin
提出日時 2016-01-30 01:17:23
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
RE  
実行時間 -
コード長 794 bytes
コンパイル時間 696 ms
コンパイル使用メモリ 91,132 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-09-21 18:56:30
合計ジャッジ時間 2,498 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 RE * 1
other AC * 17 RE * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;

    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;
}
0