結果

問題 No.269 見栄っ張りの募金活動
ユーザー yaoshimax
提出日時 2016-05-11 22:38:49
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 494 bytes
コンパイル時間 426 ms
コンパイル使用メモリ 55,140 KB
実行使用メモリ 17,756 KB
最終ジャッジ日時 2024-10-05 13:50:18
合計ジャッジ時間 6,903 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other WA * 1 TLE * 1 -- * 20
権限があれば一括ダウンロードができます

ソースコード

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