結果

問題 No.269 見栄っ張りの募金活動
ユーザー startcppstartcpp
提出日時 2015-08-22 12:57:52
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 10 ms / 5,000 ms
コード長 435 bytes
コンパイル時間 349 ms
コンパイル使用メモリ 52,116 KB
実行使用メモリ 19,300 KB
最終ジャッジ日時 2023-09-23 01:09:55
合計ジャッジ時間 1,443 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 3 ms
11,720 KB
testcase_04 AC 5 ms
9,256 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 4 ms
15,788 KB
testcase_07 AC 10 ms
19,300 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 3 ms
4,664 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 3 ms
8,340 KB
testcase_14 AC 2 ms
4,376 KB
testcase_15 AC 3 ms
6,532 KB
testcase_16 AC 2 ms
4,380 KB
testcase_17 AC 2 ms
4,376 KB
testcase_18 AC 5 ms
14,716 KB
testcase_19 AC 4 ms
8,184 KB
testcase_20 AC 2 ms
4,376 KB
testcase_21 AC 2 ms
4,376 KB
testcase_22 AC 3 ms
5,956 KB
testcase_23 AC 2 ms
5,536 KB
testcase_24 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
using namespace std;

int n, s, k;
long long f[101][20001];

long long F(int N, int M) {
	if (N < 0 || M < 0)
		return 0;
	return f[N][M];
}

int main() {
	cin >> n >> s >> k;
	s -= k * n * (n - 1)/2;
	
	f[0][0] = 1;
	for( int N = 1; N <= n; N++ ){	//残り項数
		for( int M = 0; M <= s; M++ ){	//残り値
			f[N][M] = F(N, M-N) + F(N-1, M);
			f[N][M] %= 1000000007;
		}
	}
	cout << F(n, s) << endl;
	return 0;
}
0