結果

問題 No.269 見栄っ張りの募金活動
ユーザー kyuridenamidakyuridenamida
提出日時 2015-08-21 23:27:59
言語 C++11
(gcc 11.4.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 822 bytes
コンパイル時間 1,145 ms
コンパイル使用メモリ 145,828 KB
実行使用メモリ 12,272 KB
最終ジャッジ日時 2023-09-23 01:06:21
合計ジャッジ時間 18,777 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 5 ms
12,044 KB
testcase_01 AC 5 ms
12,088 KB
testcase_02 AC 5 ms
12,112 KB
testcase_03 AC 18 ms
12,236 KB
testcase_04 AC 3,641 ms
12,028 KB
testcase_05 AC 6 ms
12,108 KB
testcase_06 AC 5 ms
12,012 KB
testcase_07 TLE -
testcase_08 AC 5 ms
12,060 KB
testcase_09 AC 5 ms
12,064 KB
testcase_10 AC 5 ms
12,052 KB
testcase_11 AC 1,689 ms
11,964 KB
testcase_12 AC 5 ms
11,992 KB
testcase_13 AC 748 ms
12,272 KB
testcase_14 AC 566 ms
12,084 KB
testcase_15 AC 1,059 ms
11,984 KB
testcase_16 AC 5 ms
12,104 KB
testcase_17 AC 5 ms
12,052 KB
testcase_18 AC 1,106 ms
12,012 KB
testcase_19 AC 356 ms
11,964 KB
testcase_20 AC 245 ms
11,988 KB
testcase_21 AC 893 ms
12,108 KB
testcase_22 AC 262 ms
12,104 KB
testcase_23 AC 10 ms
12,060 KB
testcase_24 AC 671 ms
12,236 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

string tb1 = "A123456789TJQK";
string tb2 = "DCHS";

bool cmp(string a,string b){
    a[0] = 'A'+tb2.find(a[0]);
    a[1] = 'A'+tb1.find(a[1]);
    b[0] = 'A'+tb2.find(b[0]);
    b[1] = 'A'+tb1.find(b[1]);	
    return a < b;
}

int Klim;

int sum[20210] = {};
int dp[110][20110];
int N,S,K;
vector<int> v;
int dfs(int x,int s){
    if( s < 0 ) return 0;
    if( dp[x][s] != -1 ) return dp[x][s];
    if( x == 0 ){
        return s == 0;
    }
    int ans = 0;
    for(int i = 0 ; ; i++){
        int c = i * x;
        if( c > s ) break;
        ans += dfs(x-1,s-c); 
		if( ans >= 1000000007 ) ans -= 1000000007;
    }
    return dp[x][s] = ans;
}



int main(){
    memset(dp,-1,sizeof(dp));
    cin >> N >> S >> K;
    S -= K*N*(N-1)/2;
    cout << dfs(N,S) << endl;
    
}
0