結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 14 ms
14,588 KB
testcase_01 MLE -
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 269 ms
270,400 KB
testcase_06 AC 231 ms
219,648 KB
testcase_07 AC 404 ms
399,832 KB
testcase_08 AC 369 ms
384,712 KB
testcase_09 AC 208 ms
194,176 KB
testcase_10 AC 454 ms
454,688 KB
testcase_11 AC 236 ms
231,152 KB
testcase_12 AC 32 ms
30,272 KB
testcase_13 AC 23 ms
21,780 KB
testcase_14 AC 235 ms
223,512 KB
testcase_15 AC 197 ms
190,188 KB
testcase_16 AC 277 ms
264,796 KB
testcase_17 AC 179 ms
168,588 KB
testcase_18 AC 403 ms
398,468 KB
testcase_19 MLE -
testcase_20 AC 343 ms
331,540 KB
testcase_21 AC 225 ms
209,488 KB
testcase_22 AC 277 ms
271,300 KB
testcase_23 AC 452 ms
447,660 KB
testcase_24 MLE -
testcase_25 AC 219 ms
217,936 KB
testcase_26 AC 316 ms
318,712 KB
testcase_27 AC 295 ms
295,212 KB
testcase_28 AC 362 ms
343,692 KB
testcase_29 AC 2 ms
4,380 KB
testcase_30 AC 2 ms
4,376 KB
testcase_31 AC 2 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,380 KB
testcase_35 AC 2 ms
4,380 KB
testcase_36 AC 3 ms
5,252 KB
testcase_37 AC 3 ms
4,504 KB
testcase_38 AC 40 ms
38,760 KB
testcase_39 AC 43 ms
40,264 KB
testcase_40 AC 114 ms
109,692 KB
testcase_41 AC 140 ms
140,936 KB
testcase_42 AC 64 ms
64,648 KB
testcase_43 AC 15 ms
15,732 KB
testcase_44 MLE -
testcase_45 AC 35 ms
35,700 KB
testcase_46 AC 20 ms
19,072 KB
testcase_47 MLE -
testcase_48 AC 382 ms
396,896 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){
		for(int j=0; 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