結果

問題 No.269 見栄っ張りの募金活動
ユーザー reew2nreew2n
提出日時 2015-12-11 17:55:24
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 4,699 ms / 5,000 ms
コード長 452 bytes
コンパイル時間 331 ms
コンパイル使用メモリ 53,024 KB
実行使用メモリ 18,972 KB
最終ジャッジ日時 2023-09-23 01:18:23
合計ジャッジ時間 24,938 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 9 ms
4,376 KB
testcase_03 AC 68 ms
4,652 KB
testcase_04 AC 3,817 ms
9,284 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 4,699 ms
18,972 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 915 ms
10,552 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 2,569 ms
4,896 KB
testcase_12 AC 676 ms
8,860 KB
testcase_13 AC 780 ms
5,424 KB
testcase_14 AC 1,357 ms
4,376 KB
testcase_15 AC 1,120 ms
5,364 KB
testcase_16 AC 1,044 ms
8,372 KB
testcase_17 AC 65 ms
4,624 KB
testcase_18 AC 3,233 ms
13,496 KB
testcase_19 AC 788 ms
5,968 KB
testcase_20 AC 308 ms
4,376 KB
testcase_21 AC 1,171 ms
4,376 KB
testcase_22 AC 263 ms
4,488 KB
testcase_23 AC 17 ms
4,376 KB
testcase_24 AC 674 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,b) FOR(i,0,b)
using namespace std;
typedef long long LL;
LL DP[101][20001];
const LL p=7+1e+9;
int main() {
	LL N,S,K;
	cin >> N >> S >> K;
	DP[0][0]=1;
	LL c=0;
	FOR(i,1,N+1){
		REP(j,S+1){
			FOR(k,c,S+1){
				if(j-k*(N-i+1) < 0) break;
				DP[i][j]+=DP[i-1][j-k*(N-i+1)];
				DP[i][j]%=p;
			}
		}
		c=K;
	}
	cout << DP[N][S] << endl;
	// your code goes here
	return 0;
}
0