結果

問題 No.129 お年玉(2)
ユーザー koyumeishikoyumeishi
提出日時 2015-01-16 23:49:15
言語 C++11
(gcc 11.4.0)
結果
MLE  
実行時間 -
コード長 774 bytes
コンパイル時間 1,857 ms
コンパイル使用メモリ 77,216 KB
実行使用メモリ 784,996 KB
最終ジャッジ日時 2023-09-04 14:29:55
合計ジャッジ時間 20,889 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 19 ms
14,648 KB
testcase_01 MLE -
testcase_02 AC 21 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 395 ms
270,436 KB
testcase_06 AC 323 ms
219,180 KB
testcase_07 AC 591 ms
399,780 KB
testcase_08 AC 564 ms
384,868 KB
testcase_09 AC 281 ms
193,840 KB
testcase_10 AC 667 ms
454,704 KB
testcase_11 AC 335 ms
230,828 KB
testcase_12 AC 40 ms
29,688 KB
testcase_13 AC 29 ms
21,600 KB
testcase_14 AC 328 ms
223,140 KB
testcase_15 AC 275 ms
190,144 KB
testcase_16 AC 386 ms
264,684 KB
testcase_17 AC 243 ms
168,300 KB
testcase_18 AC 586 ms
398,476 KB
testcase_19 MLE -
testcase_20 AC 486 ms
331,276 KB
testcase_21 AC 302 ms
209,332 KB
testcase_22 AC 394 ms
271,264 KB
testcase_23 AC 655 ms
447,684 KB
testcase_24 MLE -
testcase_25 AC 316 ms
217,892 KB
testcase_26 AC 465 ms
319,044 KB
testcase_27 AC 434 ms
295,420 KB
testcase_28 AC 505 ms
343,412 KB
testcase_29 AC 2 ms
4,380 KB
testcase_30 AC 2 ms
4,380 KB
testcase_31 AC 1 ms
4,376 KB
testcase_32 AC 2 ms
4,380 KB
testcase_33 AC 2 ms
4,376 KB
testcase_34 AC 2 ms
4,376 KB
testcase_35 AC 2 ms
4,376 KB
testcase_36 AC 4 ms
4,544 KB
testcase_37 AC 3 ms
4,380 KB
testcase_38 AC 54 ms
38,704 KB
testcase_39 AC 57 ms
39,952 KB
testcase_40 AC 159 ms
109,232 KB
testcase_41 AC 203 ms
140,912 KB
testcase_42 AC 92 ms
64,500 KB
testcase_43 AC 20 ms
15,464 KB
testcase_44 MLE -
testcase_45 AC 51 ms
35,732 KB
testcase_46 AC 25 ms
18,568 KB
testcase_47 MLE -
testcase_48 AC 619 ms
397,144 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <cstdio>
#include <sstream>
#include <map>
#include <string>
#include <algorithm>
#include <queue>
#include <cmath>
#include <set>
using namespace std;

#define MOD 1000000000

int main(){
	long long n,m;
	cin >> n >> m;
	n -= ((n/m)/1000) * 1000 * m;

	n /= 1000;
	//cout << n << endl;

	//dp[i][j] := 使った千円札の数がi枚で、j番目の袋までに入れた場合の組み合わせ
	vector<vector<long long>> dp(n+1, vector<long long>(m+1, 0));
	dp[0][0] = 1;
	for(int i=0; i<=n; i++){
		for(int j=0; j<m; j++){
			dp[i][j+1] += dp[i][j];
			dp[i][j+1] %= MOD;
			if(i+1 <= n){
				dp[i+1][j+1] += dp[i][j];
				dp[i+1][j+1] %= MOD;
			}
		}
	}

	long long ans = dp[n][m] % MOD;
	cout << ans << endl;
	return 0;
}
0