結果

問題 No.269 見栄っ張りの募金活動
ユーザー snteasntea
提出日時 2015-09-22 04:56:55
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 3,794 ms / 5,000 ms
コード長 1,393 bytes
コンパイル時間 658 ms
コンパイル使用メモリ 75,312 KB
実行使用メモリ 18,992 KB
最終ジャッジ日時 2023-09-23 01:14:09
合計ジャッジ時間 18,406 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 7 ms
5,612 KB
testcase_03 AC 55 ms
6,664 KB
testcase_04 AC 2,920 ms
9,788 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 3,794 ms
18,992 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 739 ms
10,628 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 1,682 ms
4,972 KB
testcase_12 AC 541 ms
10,412 KB
testcase_13 AC 577 ms
6,484 KB
testcase_14 AC 453 ms
4,380 KB
testcase_15 AC 803 ms
6,688 KB
testcase_16 AC 819 ms
9,788 KB
testcase_17 AC 50 ms
6,304 KB
testcase_18 AC 2,563 ms
14,428 KB
testcase_19 AC 594 ms
7,464 KB
testcase_20 AC 181 ms
4,376 KB
testcase_21 AC 532 ms
4,380 KB
testcase_22 AC 195 ms
6,080 KB
testcase_23 AC 13 ms
5,604 KB
testcase_24 AC 399 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cmath>
#include <climits>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <algorithm>
#include <sstream>
#include <map>
#include <set>
#include <utility>

#define endl '\n'
#define ALL(a)  (a).begin(),(a).end()
#define SZ(a) int((a).size())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define DEBUG(x) cout<<#x<<": "<<x<<endl

using namespace std;

typedef pair<int,int> P;
typedef long long int LL;

const int MAX_N=100,MAX_S=20000,MAX_K=100;
const int mod=1000000007;
LL dp[MAX_N][MAX_S+1];

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	int N,S,K;
	cin>>N>>S>>K;
	RREP(i,N){
		//DEBUG(i);
		RREP(j,S+1){
		//	DEBUG(j);
			if(i==N-1){
				dp[i][j]=1;
			}else{
				/*if(N-i-1<=j&&j+(N-i)<=S){
					//cout<<i<<' '<<j<<endl;
					if(!(0<=j+(N-i)-(N-i-1)*K&&j+(N-i)-(N-i-1)*K<=S))	cout<<"hoge"<<endl;
					dp[i][j]=(dp[i][j+(N-i)]-dp[i+1][j+(N-i)-(N-i-1)*K])%mod;
				}else{*/
					for(int k=0;0<=j-(N-i-1)*(K+k)-k;k++){
						dp[i][j]+=dp[i+1][j-(N-i-1)*(K+k)-k];
						dp[i][j]%=mod;
					}
				//}
			}
		}
	}
	REP(i,N){
		REP(j,S+1){
			//cout<<dp[i][j]<<' ';	
			if(dp[i][j]>=mod){
				cout<<i<<' '<<j<<endl;
			}
		}
		//cout<<endl;
	}
	cout<<dp[0][S]<<endl;
	return 0;
}
0