結果

問題 No.269 見栄っ張りの募金活動
ユーザー 中川 瑛慎中川 瑛慎
提出日時 2018-05-10 18:11:03
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 23 ms / 5,000 ms
コード長 718 bytes
コンパイル時間 457 ms
コンパイル使用メモリ 62,868 KB
実行使用メモリ 18,968 KB
最終ジャッジ日時 2023-09-23 01:28:17
合計ジャッジ時間 1,680 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,500 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 3 ms
4,376 KB
testcase_04 AC 21 ms
17,936 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 23 ms
18,968 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 15 ms
15,652 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 11 ms
10,236 KB
testcase_14 AC 18 ms
18,960 KB
testcase_15 AC 12 ms
11,888 KB
testcase_16 AC 2 ms
4,376 KB
testcase_17 AC 2 ms
4,380 KB
testcase_18 AC 12 ms
11,520 KB
testcase_19 AC 7 ms
7,920 KB
testcase_20 AC 7 ms
8,528 KB
testcase_21 AC 16 ms
16,536 KB
testcase_22 AC 7 ms
7,396 KB
testcase_23 AC 3 ms
4,380 KB
testcase_24 AC 11 ms
11,936 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cstdio>
#include <queue>
#include <stack>

using namespace std;
const long INF = 1000000007;

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

int dp[20030][200];
int main(){
  int N,S,K;
  cin >> N >> S >> K;

  dp[0][0] = 1;
  if(S<K*N*(N-1)/2){
    cout << 0 << endl;
  }else{
    S = S-K*N*(N-1)/2;
    for(int i=0;i<=S;++i){
      for(int j=1;j<=N;++j){
        if(i-j>=0){
          dp[i][j] = (dp[i][j-1]+dp[i-j][j]) % INF;
        }else{
          dp[i][j] = dp[i][j-1] % INF;
        }
      }
    }
    cout << dp[S][N]  << endl;
  }
}
0