結果

問題 No.129 お年玉(2)
ユーザー fiordfiord
提出日時 2015-07-01 22:21:28
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 199 ms / 5,000 ms
コード長 466 bytes
コンパイル時間 1,726 ms
コンパイル使用メモリ 144,628 KB
実行使用メモリ 343,504 KB
最終ジャッジ日時 2023-08-18 17:19:58
合計ジャッジ時間 5,437 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 6 ms
14,924 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 23 ms
54,348 KB
testcase_06 AC 107 ms
219,416 KB
testcase_07 AC 115 ms
229,124 KB
testcase_08 AC 21 ms
44,024 KB
testcase_09 AC 87 ms
194,288 KB
testcase_10 AC 90 ms
197,076 KB
testcase_11 AC 75 ms
180,364 KB
testcase_12 AC 14 ms
30,008 KB
testcase_13 AC 10 ms
21,660 KB
testcase_14 AC 109 ms
223,524 KB
testcase_15 AC 81 ms
190,484 KB
testcase_16 AC 122 ms
243,200 KB
testcase_17 AC 73 ms
168,612 KB
testcase_18 AC 77 ms
182,584 KB
testcase_19 AC 37 ms
82,896 KB
testcase_20 AC 154 ms
283,980 KB
testcase_21 AC 102 ms
209,448 KB
testcase_22 AC 69 ms
162,300 KB
testcase_23 AC 116 ms
224,512 KB
testcase_24 AC 20 ms
40,200 KB
testcase_25 AC 86 ms
195,736 KB
testcase_26 AC 46 ms
105,304 KB
testcase_27 AC 50 ms
115,676 KB
testcase_28 AC 199 ms
343,504 KB
testcase_29 AC 2 ms
4,380 KB
testcase_30 AC 1 ms
4,380 KB
testcase_31 AC 2 ms
4,380 KB
testcase_32 AC 1 ms
4,376 KB
testcase_33 AC 2 ms
4,376 KB
testcase_34 AC 2 ms
4,376 KB
testcase_35 AC 2 ms
4,380 KB
testcase_36 AC 3 ms
5,240 KB
testcase_37 AC 3 ms
4,380 KB
testcase_38 AC 16 ms
39,036 KB
testcase_39 AC 18 ms
40,328 KB
testcase_40 AC 47 ms
109,320 KB
testcase_41 AC 39 ms
93,216 KB
testcase_42 AC 16 ms
36,948 KB
testcase_43 AC 7 ms
15,696 KB
testcase_44 AC 49 ms
113,144 KB
testcase_45 AC 11 ms
21,492 KB
testcase_46 AC 9 ms
18,936 KB
testcase_47 AC 85 ms
187,448 KB
testcase_48 AC 25 ms
55,908 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define E 1000000000
int main(){
	ll n,m;	cin>>n>>m;
	n/=1000;
	n%=m;
	if(n==0){
		cout<<1<<endl;
		return 0;
	}
	//mCnを求めれば良い
	if(n>m/2)	n=m-n;
	ll dp[m][n+1];
	for(int i=0;i<m;i++){
		for(int j=0;j<=n;j++)	dp[i][j]=1;
	}
	for(int i=1;i<m;i++){
		for(int j=1;j<=min((ll)i,n);j++){
			dp[i][j]=dp[i-1][j-1]+dp[i-1][j];
			dp[i][j]%=E;
		}
	}
	cout<<dp[m-1][n]<<endl;
	return 0;
}
0