結果

問題 No.129 お年玉(2)
ユーザー koyumeishikoyumeishi
提出日時 2015-01-17 00:09:31
言語 C++11
(gcc 11.4.0)
結果
MLE  
実行時間 -
コード長 758 bytes
コンパイル時間 1,509 ms
コンパイル使用メモリ 77,352 KB
実行使用メモリ 784,700 KB
最終ジャッジ日時 2023-09-04 14:53:24
合計ジャッジ時間 13,763 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 14 ms
14,620 KB
testcase_01 MLE -
testcase_02 AC 5 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 224 ms
270,536 KB
testcase_06 AC 217 ms
219,168 KB
testcase_07 AC 389 ms
400,052 KB
testcase_08 AC 307 ms
384,840 KB
testcase_09 AC 199 ms
194,392 KB
testcase_10 AC 401 ms
454,704 KB
testcase_11 AC 216 ms
231,216 KB
testcase_12 AC 33 ms
29,964 KB
testcase_13 AC 24 ms
21,860 KB
testcase_14 AC 225 ms
223,396 KB
testcase_15 AC 191 ms
190,244 KB
testcase_16 AC 255 ms
264,736 KB
testcase_17 AC 176 ms
168,472 KB
testcase_18 AC 353 ms
398,584 KB
testcase_19 MLE -
testcase_20 AC 315 ms
331,372 KB
testcase_21 AC 219 ms
209,564 KB
testcase_22 AC 264 ms
271,224 KB
testcase_23 AC 401 ms
447,612 KB
testcase_24 MLE -
testcase_25 AC 207 ms
218,048 KB
testcase_26 AC 274 ms
318,740 KB
testcase_27 AC 260 ms
295,192 KB
testcase_28 AC 341 ms
343,608 KB
testcase_29 AC 2 ms
4,380 KB
testcase_30 AC 2 ms
4,380 KB
testcase_31 AC 2 ms
4,380 KB
testcase_32 AC 2 ms
4,376 KB
testcase_33 AC 2 ms
4,380 KB
testcase_34 AC 2 ms
4,376 KB
testcase_35 AC 2 ms
4,376 KB
testcase_36 AC 3 ms
5,048 KB
testcase_37 AC 3 ms
4,380 KB
testcase_38 AC 37 ms
38,668 KB
testcase_39 AC 41 ms
40,232 KB
testcase_40 AC 114 ms
109,084 KB
testcase_41 AC 128 ms
140,980 KB
testcase_42 AC 58 ms
64,552 KB
testcase_43 AC 15 ms
15,688 KB
testcase_44 MLE -
testcase_45 AC 31 ms
35,852 KB
testcase_46 AC 20 ms
19,028 KB
testcase_47 MLE -
testcase_48 AC 316 ms
396,996 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;

	vector<vector<long long>> dp(m+1, vector<long long>(n+1, 0));
	dp[0][0] = 1;
	for(int i=0; i<m; ++i){
		//cerr << max(0LL, n-(m-i)) << endl;
		for(int j=max(0LL, n-(m-i)); j<=i+1 && j<=n; ++j){
			
			dp[i+1][j] += dp[i][j];
			if(dp[i+1][j]>=MOD) dp[i+1][j] -= MOD;

			if(j+1<=n){
				dp[i+1][j+1] += dp[i][j];
				if(dp[i+1][j+1]>=MOD) dp[i+1][j+1] -= MOD;
			}
			
		}
	}

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