結果

問題 No.129 お年玉(2)
ユーザー nksk38nksk38
提出日時 2017-07-16 15:25:34
言語 C++11
(gcc 11.4.0)
結果
MLE  
(最新)
AC  
(最初)
実行時間 -
コード長 940 bytes
コンパイル時間 1,277 ms
コンパイル使用メモリ 73,180 KB
実行使用メモリ 764,912 KB
最終ジャッジ日時 2023-08-18 18:01:01
合計ジャッジ時間 18,749 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 56 ms
155,668 KB
testcase_01 MLE -
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 306 ms
365,920 KB
testcase_06 AC 500 ms
468,484 KB
testcase_07 MLE -
testcase_08 AC 397 ms
446,768 KB
testcase_09 MLE -
testcase_10 MLE -
testcase_11 AC 385 ms
437,288 KB
testcase_12 MLE -
testcase_13 MLE -
testcase_14 MLE -
testcase_15 AC 412 ms
456,516 KB
testcase_16 MLE -
testcase_17 MLE -
testcase_18 MLE -
testcase_19 MLE -
testcase_20 MLE -
testcase_21 MLE -
testcase_22 MLE -
testcase_23 MLE -
testcase_24 MLE -
testcase_25 MLE -
testcase_26 MLE -
testcase_27 MLE -
testcase_28 MLE -
testcase_29 AC 2 ms
4,376 KB
testcase_30 AC 1 ms
4,376 KB
testcase_31 AC 2 ms
5,464 KB
testcase_32 AC 2 ms
5,788 KB
testcase_33 AC 16 ms
62,860 KB
testcase_34 AC 9 ms
36,440 KB
testcase_35 AC 15 ms
58,804 KB
testcase_36 AC 16 ms
62,780 KB
testcase_37 AC 18 ms
71,048 KB
testcase_38 AC 99 ms
257,344 KB
testcase_39 AC 139 ms
321,020 KB
testcase_40 MLE -
testcase_41 AC 217 ms
425,288 KB
testcase_42 AC 110 ms
275,852 KB
testcase_43 AC 108 ms
271,692 KB
testcase_44 MLE -
testcase_45 AC 69 ms
202,232 KB
testcase_46 AC 149 ms
339,292 KB
testcase_47 MLE -
testcase_48 MLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<cstdio>
#include<iostream>
#include<algorithm>
#include<string>
#include<queue>
#include<vector>
#include<functional>
#include<cmath>
#include<map>
#include<stack>
#include<set>
#include<numeric>
#include<limits>

#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()

using namespace std;
typedef long long ll;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<ll, string> pls;

ll mod = (ll)1e9;


ll C[10010][10010];

void comb_table(ll N) {
	for (ll i = 0; i <= N; i++) {
		for (ll j = 0; j <= i; j++) {
			if (j == 0 || j == i) {
				C[i][j] = 1LL;
			}
			else {
				C[i][j] = C[i - 1][j - 1] + C[i - 1][j];
				C[i][j] %= mod;
			}
		}
	}
}

int main()
{
	ll N, M,left;
	cin >> N >> M;
	comb_table(M);

	left = N;
	N /= 1000;

	ll ans;
	if (N >= M) {
		N /= M;
		left -= M * N * 1000;
		left /= 1000;
		ans = C[M][left];
	}
	else 
		ans = C[M][N];
	
	cout << ans << endl;

	return	0;
}
0