結果

問題 No.269 見栄っ張りの募金活動
ユーザー yaoshimaxyaoshimax
提出日時 2016-05-11 22:47:23
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 35 ms / 5,000 ms
コード長 448 bytes
コンパイル時間 323 ms
コンパイル使用メモリ 51,956 KB
実行使用メモリ 11,748 KB
最終ジャッジ日時 2023-09-23 01:18:35
合計ジャッジ時間 1,473 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 6 ms
11,300 KB
testcase_01 AC 6 ms
11,296 KB
testcase_02 AC 6 ms
11,240 KB
testcase_03 AC 6 ms
11,224 KB
testcase_04 AC 16 ms
11,244 KB
testcase_05 AC 5 ms
11,240 KB
testcase_06 AC 6 ms
11,496 KB
testcase_07 AC 35 ms
11,288 KB
testcase_08 AC 5 ms
11,196 KB
testcase_09 AC 5 ms
11,220 KB
testcase_10 AC 6 ms
11,352 KB
testcase_11 AC 7 ms
11,312 KB
testcase_12 AC 5 ms
11,196 KB
testcase_13 AC 8 ms
11,292 KB
testcase_14 AC 6 ms
11,748 KB
testcase_15 AC 8 ms
11,272 KB
testcase_16 AC 5 ms
11,280 KB
testcase_17 AC 5 ms
11,280 KB
testcase_18 AC 15 ms
11,308 KB
testcase_19 AC 8 ms
11,208 KB
testcase_20 AC 6 ms
11,276 KB
testcase_21 AC 6 ms
11,572 KB
testcase_22 AC 7 ms
11,244 KB
testcase_23 AC 6 ms
11,284 KB
testcase_24 AC 6 ms
11,320 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
using namespace std;
int memo[101][20001];
int mod=1000000007;
int rec(int N, int S){
   if( S<0 ) return 0;
   if( N==1 ) return memo[N][S]=1;
   if( memo[N][S]!=-1) return memo[N][S];
   memo[N][S]=0;
   return memo[N][S]=(rec(N,S-N)+rec(N-1,S))%mod;
}
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