結果

問題 No.269 見栄っ張りの募金活動
ユーザー highd
提出日時 2016-10-27 11:06:19
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 1,194 ms / 5,000 ms
コード長 735 bytes
コンパイル時間 506 ms
コンパイル使用メモリ 64,552 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-16 01:57:48
合計ジャッジ時間 4,894 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cstdint>

int main() {
	std::uint_fast32_t map[20001] = { 1 };
	std::uint_fast32_t map_tmp[20001] = { 1 };
	int n, maney, k;
	std::cin >> n >> maney >> k;
	maney -= (n - 1)*n/2*k;

	for (int i = 0; i <= maney; i++) {
		map[i] = 1;
	}
	if (maney < 0) {
		std::cout << 0 << std::endl;
		return 0;
	}
	for (int i = 1; i < n ; i++) {
		for (int j = 0; j <= maney; j++) {
			int now_maney = j;
			std::uint_fast32_t count = 0;
			while (now_maney >= 0) {
				count += map[now_maney];
				if (count > 1000000007) {
					count -= 1000000007;
				}
				now_maney -= i + 1;
			}
			map_tmp[j] = count;
		}
		for (int j = 0; j <= maney; j++) {
			map[j] = map_tmp[j];
		}
	}
	std::cout << map[maney] << std::endl;
}
0