結果

問題 No.269 見栄っ張りの募金活動
ユーザー sugarrrsugarrr
提出日時 2018-03-10 11:47:36
言語 C++11
(gcc 11.4.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 986 bytes
コンパイル時間 867 ms
コンパイル使用メモリ 80,788 KB
実行使用メモリ 19,328 KB
最終ジャッジ日時 2024-04-21 06:33:44
合計ジャッジ時間 19,221 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 AC 14 ms
6,940 KB
testcase_04 AC 3,597 ms
9,088 KB
testcase_05 AC 2 ms
6,940 KB
testcase_06 AC 1 ms
6,940 KB
testcase_07 TLE -
testcase_08 AC 2 ms
6,940 KB
testcase_09 AC 2 ms
6,948 KB
testcase_10 AC 2 ms
6,944 KB
testcase_11 AC 1,748 ms
6,940 KB
testcase_12 AC 2 ms
6,940 KB
testcase_13 AC 735 ms
6,940 KB
testcase_14 AC 1,471 ms
6,940 KB
testcase_15 AC 1,039 ms
6,940 KB
testcase_16 AC 2 ms
6,944 KB
testcase_17 AC 1 ms
6,944 KB
testcase_18 AC 1,068 ms
8,832 KB
testcase_19 AC 343 ms
6,940 KB
testcase_20 AC 260 ms
6,944 KB
testcase_21 AC 1,216 ms
6,944 KB
testcase_22 AC 259 ms
6,944 KB
testcase_23 AC 7 ms
6,944 KB
testcase_24 AC 721 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #


#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#include<stack>
#include<queue>
#include<vector>
#include<algorithm>
#include<string>
#include<iostream>
#include<set>
#include<map>
#include<bitset>

using namespace std;
typedef long long ll;
#define i_7 1000000007
#define i_5 1000000005

ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    else return c+i_7;
}
typedef pair<int,int> i_i;
typedef pair<ll,ll> l_l;
#define inf 100000000/*10^8*/
#define rep(i,l,r) for(int i=l;i<=r;i++)
const double EPS=1E-8;

////////////////////////////////////////


int main() {
    int n,s,k;cin>>n>>s>>k;
    s-=k*(n-1)*n/2;
    if(s<0){
        cout<<0<<endl;return 0;
    }
    //sをn個に分ける
    ll dp[n+1][s+1];memset(dp,0,sizeof(dp));dp[0][0]=1;
    rep(i,1,n){
        rep(j,0,s){
            for(int k=0;j-k*(n-i+1)>=0;k++){
                dp[i][j]=mod(dp[i][j]+dp[i-1][j-k*(n-i+1)]);
            }
        }
    }
    cout<<dp[n][s];
    return 0;
}
0