結果

問題 No.269 見栄っ張りの募金活動
ユーザー nasadigitalnasadigital
提出日時 2015-08-22 14:27:14
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 32 ms / 5,000 ms
コード長 461 bytes
コンパイル時間 1,145 ms
コンパイル使用メモリ 143,216 KB
実行使用メモリ 12,492 KB
最終ジャッジ日時 2023-09-23 01:10:31
合計ジャッジ時間 2,525 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 5 ms
11,240 KB
testcase_01 AC 5 ms
11,248 KB
testcase_02 AC 6 ms
11,608 KB
testcase_03 AC 7 ms
11,356 KB
testcase_04 AC 16 ms
12,216 KB
testcase_05 AC 6 ms
11,580 KB
testcase_06 AC 6 ms
11,280 KB
testcase_07 AC 32 ms
12,168 KB
testcase_08 AC 6 ms
11,240 KB
testcase_09 AC 11 ms
11,640 KB
testcase_10 AC 5 ms
11,256 KB
testcase_11 AC 9 ms
12,492 KB
testcase_12 AC 10 ms
11,604 KB
testcase_13 AC 10 ms
11,728 KB
testcase_14 AC 7 ms
12,180 KB
testcase_15 AC 8 ms
11,840 KB
testcase_16 AC 11 ms
11,704 KB
testcase_17 AC 6 ms
11,684 KB
testcase_18 AC 20 ms
12,084 KB
testcase_19 AC 11 ms
12,000 KB
testcase_20 AC 6 ms
11,708 KB
testcase_21 AC 7 ms
12,300 KB
testcase_22 AC 8 ms
11,612 KB
testcase_23 AC 6 ms
11,308 KB
testcase_24 AC 7 ms
11,752 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define MOD 1000000007
using namespace std;

int n,s,k;
int dp[101][20001];

int rek(int cur,int sc){
    if(cur==0 && sc==0)
        return 1;
    if(cur<0)
        return 0;
    if(sc<0)
        return 0;
    if(dp[cur][sc]==-1){
        dp[cur][sc]=(rek(cur-1,sc-(n-cur)*k)+rek(cur,sc-(n-cur)))%MOD;
    }
    return dp[cur][sc];
}


int main()
{
    memset(dp,-1,sizeof(dp));
    cin>>n>>s>>k;
    cout<<rek(n-1,s);
    return 0;
}
0