結果

問題 No.269 見栄っ張りの募金活動
ユーザー yaoshimaxyaoshimax
提出日時 2016-05-11 22:38:49
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 494 bytes
コンパイル時間 1,103 ms
コンパイル使用メモリ 55,452 KB
実行使用メモリ 17,908 KB
最終ジャッジ日時 2024-04-15 15:14:19
合計ジャッジ時間 7,103 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 5 ms
11,148 KB
testcase_02 AC 5 ms
11,364 KB
testcase_03 AC 27 ms
11,284 KB
testcase_04 TLE -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
using namespace std;
int memo[101][20001];
int mod=1000000007;
int rec(int N, int S){
   if( N==1 ) return memo[N][S]=1;
   if( memo[N][S]!=-1) return memo[N][S];
   memo[N][S]=0;
   for( int i=0 ; i < 1+S/N; i++){
      memo[N][S]+=rec(N-1,S-i*N);
      memo[N][S]%=mod;
   }
   return memo[N][S];
}
int main(){
   int N,S,K;
   for( int i = 0 ; i <101; i++ ) for( int j = 0 ; j < 20001; j++) memo[i][j]=-1;
   cin >> N >> S >> K;
   S-=K*N*(N-1)/2;
   cout << rec(N,S);
}
0