結果

問題 No.269 見栄っ張りの募金活動
ユーザー leaf_bleaf_b
提出日時 2019-09-19 00:14:38
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 889 bytes
コンパイル時間 1,406 ms
コンパイル使用メモリ 165,524 KB
実行使用メモリ 19,620 KB
最終ジャッジ日時 2023-09-24 23:56:57
合計ジャッジ時間 2,824 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 4 ms
11,892 KB
testcase_04 AC 5 ms
9,256 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 4 ms
17,740 KB
testcase_07 WA -
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 3 ms
4,652 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 4 ms
8,336 KB
testcase_14 AC 2 ms
4,380 KB
testcase_15 AC 3 ms
6,544 KB
testcase_16 AC 1 ms
4,380 KB
testcase_17 AC 2 ms
4,376 KB
testcase_18 AC 6 ms
14,572 KB
testcase_19 AC 3 ms
8,084 KB
testcase_20 AC 2 ms
4,376 KB
testcase_21 AC 2 ms
4,376 KB
testcase_22 AC 3 ms
5,948 KB
testcase_23 AC 2 ms
5,600 KB
testcase_24 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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