結果

問題 No.129 お年玉(2)
ユーザー lapilapi
提出日時 2019-07-07 19:59:59
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
MLE  
(最新)
AC  
(最初)
実行時間 -
コード長 841 bytes
コンパイル時間 1,137 ms
コンパイル使用メモリ 105,704 KB
実行使用メモリ 719,408 KB
最終ジャッジ日時 2023-08-18 18:20:13
合計ジャッジ時間 12,096 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
175,508 KB
testcase_01 MLE -
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 170 ms
477,732 KB
testcase_06 MLE -
testcase_07 MLE -
testcase_08 MLE -
testcase_09 MLE -
testcase_10 MLE -
testcase_11 MLE -
testcase_12 MLE -
testcase_13 MLE -
testcase_14 MLE -
testcase_15 MLE -
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 1 ms
4,380 KB
testcase_30 AC 2 ms
4,376 KB
testcase_31 AC 2 ms
5,480 KB
testcase_32 AC 2 ms
5,484 KB
testcase_33 AC 15 ms
62,924 KB
testcase_34 AC 9 ms
36,152 KB
testcase_35 AC 14 ms
58,792 KB
testcase_36 AC 14 ms
62,824 KB
testcase_37 AC 17 ms
70,968 KB
testcase_38 AC 66 ms
257,392 KB
testcase_39 AC 86 ms
320,876 KB
testcase_40 AC 200 ms
509,420 KB
testcase_41 AC 123 ms
425,384 KB
testcase_42 AC 70 ms
275,812 KB
testcase_43 AC 70 ms
271,788 KB
testcase_44 MLE -
testcase_45 AC 49 ms
202,156 KB
testcase_46 AC 92 ms
339,392 KB
testcase_47 MLE -
testcase_48 MLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <numeric>
#include <regex>
#include <tuple>
#include <iomanip>
#include <cmath>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
#define MOD 1000000007 // 10^9 + 7
#define INF 1000000000 // 10^9
#define LLINF 1LL<<60

ll Com[10009][10009]; // C[n][k] = nCk

void combination_table(int N) {
	for (int i = 0; i <= N; i++) {
		for (int j = 0; j <= i; j++) {
			if (j == 0 || j == i) Com[i][j] = 1LL;
			else Com[i][j] = (Com[i - 1][j] + Com[i - 1][j - 1]) % INF;
		}
	}
}


int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	ll N, M; cin >> N >> M;
	N /= 1000;
	N = N % M;
	combination_table(M);

	cout << Com[M][min(N, M - N)] << endl;

	return 0;
}
0