結果

問題 No.269 見栄っ張りの募金活動
ユーザー とくまるproとくまるpro
提出日時 2020-05-19 19:04:49
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 18 ms / 5,000 ms
コード長 1,208 bytes
コンパイル時間 1,729 ms
コンパイル使用メモリ 171,744 KB
実行使用メモリ 19,396 KB
最終ジャッジ日時 2023-07-25 04:34:14
合計ジャッジ時間 3,454 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 8 ms
8,996 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 18 ms
19,396 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 1 ms
4,384 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 3 ms
4,376 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 4 ms
4,860 KB
testcase_14 AC 2 ms
4,376 KB
testcase_15 AC 4 ms
4,872 KB
testcase_16 AC 1 ms
4,384 KB
testcase_17 AC 1 ms
4,380 KB
testcase_18 AC 8 ms
8,508 KB
testcase_19 AC 4 ms
4,656 KB
testcase_20 AC 2 ms
4,380 KB
testcase_21 AC 2 ms
4,380 KB
testcase_22 AC 3 ms
4,376 KB
testcase_23 AC 2 ms
4,384 KB
testcase_24 AC 3 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i < (n);i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define SCANF(i) int i;scanf("%d",&i)
typedef long long ll;
using namespace std;
using P = pair<int,int>;
const long long INF = 1LL << 60;
const int IINF=100000000;
const int MOD = (int)1e9 + 7;
//約数列挙
vector<long long> divisor(long long n) {
    vector<long long> ret;
    for (long long i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            ret.push_back(i);
            if (i * i != n) ret.push_back(n / i);
        }
    }
    //sort(ret.begin(), ret.end()); // 昇順に並べる
    return ret;
}
vector<int> dx={1,0,-1,0};vector<int> dy={0,-1,0,1};

signed main () {
    ll n,s,k;cin >> n >> s >> k;
    s -= n*(n-1)*k/2;
    if(s<0) {
        cout << 0 << endl;return 0;
    }
    vector<vector<ll>> dp(n+1,vector<ll>(s+1,0));
    dp[0][0]=1;
    FOR(i,1,n+1){
        REP(j,s+1){
            if(j-i>=0)dp[i][j]=dp[i][j-i]+dp[i-1][j];
            else dp[i][j]=dp[i-1][j];
            dp[i][j]%=MOD;
        }
    }
    cout << dp[n][s] << endl;
}
//https://yukicoder.me/problems/no/269
0