結果

問題 No.129 お年玉(2)
ユーザー dnishdnish
提出日時 2017-07-10 00:38:37
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 177 ms / 5,000 ms
コード長 484 bytes
コンパイル時間 1,599 ms
コンパイル使用メモリ 165,344 KB
実行使用メモリ 393,000 KB
最終ジャッジ日時 2023-08-18 17:58:58
合計ジャッジ時間 6,860 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 23 ms
89,568 KB
testcase_01 AC 177 ms
393,000 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 83 ms
251,432 KB
testcase_06 AC 119 ms
316,732 KB
testcase_07 AC 139 ms
351,040 KB
testcase_08 AC 103 ms
289,340 KB
testcase_09 AC 127 ms
336,568 KB
testcase_10 AC 141 ms
357,244 KB
testcase_11 AC 103 ms
283,420 KB
testcase_12 AC 122 ms
324,264 KB
testcase_13 AC 125 ms
331,932 KB
testcase_14 AC 122 ms
326,136 KB
testcase_15 AC 107 ms
296,504 KB
testcase_16 AC 116 ms
317,228 KB
testcase_17 AC 135 ms
347,752 KB
testcase_18 AC 129 ms
337,376 KB
testcase_19 AC 136 ms
348,388 KB
testcase_20 AC 136 ms
347,148 KB
testcase_21 AC 169 ms
388,504 KB
testcase_22 AC 106 ms
292,412 KB
testcase_23 AC 148 ms
362,960 KB
testcase_24 AC 140 ms
355,492 KB
testcase_25 AC 102 ms
284,284 KB
testcase_26 AC 104 ms
288,532 KB
testcase_27 AC 100 ms
284,144 KB
testcase_28 AC 168 ms
390,344 KB
testcase_29 AC 2 ms
4,380 KB
testcase_30 AC 2 ms
4,380 KB
testcase_31 AC 2 ms
4,376 KB
testcase_32 AC 1 ms
4,376 KB
testcase_33 AC 7 ms
32,536 KB
testcase_34 AC 4 ms
20,244 KB
testcase_35 AC 7 ms
30,196 KB
testcase_36 AC 7 ms
32,236 KB
testcase_37 AC 7 ms
36,408 KB
testcase_38 AC 35 ms
130,536 KB
testcase_39 AC 47 ms
161,284 KB
testcase_40 AC 97 ms
274,028 KB
testcase_41 AC 72 ms
214,568 KB
testcase_42 AC 39 ms
138,748 KB
testcase_43 AC 39 ms
136,840 KB
testcase_44 AC 171 ms
391,420 KB
testcase_45 AC 27 ms
101,944 KB
testcase_46 AC 51 ms
171,500 KB
testcase_47 AC 164 ms
384,664 KB
testcase_48 AC 109 ms
298,548 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define p(s) cout<<(s)<<endl
typedef long long ll;
using namespace std;
const ll mod=1e9;

ll comb[10010][5010];
void combinationDP(int n){
	for(int i=0; i < n + 1; i++){
		for(int j=0; j < i + 1; j++){
			if(j==0 || i==j) comb[i][j]=1;
			else comb[i][j]=comb[i-1][j-1]+comb[i-1][j];
			comb[i][j]%=mod;
		}
	}
}
int main(){
	ll n,m;
	cin>>n>>m;
	ll dist=n/1000/m;
	ll r=n-dist*1000*m;
	r/=1000;
	r=min(r,m-r);
	combinationDP(m);
	p(comb[m][r]);
	return 0;
}
0