結果

問題 No.2120 場合の数の下8桁
ユーザー kiliarinkiliarin
提出日時 2022-11-04 22:39:00
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 743 bytes
コンパイル時間 211 ms
コンパイル使用メモリ 32,664 KB
実行使用メモリ 19,708 KB
最終ジャッジ日時 2023-09-26 01:08:31
合計ジャッジ時間 4,429 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 78 ms
19,708 KB
testcase_01 AC 76 ms
15,372 KB
testcase_02 AC 76 ms
15,220 KB
testcase_03 AC 75 ms
15,276 KB
testcase_04 AC 76 ms
15,336 KB
testcase_05 AC 73 ms
15,332 KB
testcase_06 AC 77 ms
15,368 KB
testcase_07 TLE -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <string.h>
#include <stdlib.h>

#define LOG(FMT...) fprintf(stderr, FMT)

typedef long long LL;
const int N = 10000005, PC = 664600;
const int mod = 100000000;

int pr[PC], cnt;
bool ws[N];

void sieve() {
	for (int i = 2; i < N; ++i) {
		if (!ws[i]) {
			pr[cnt++] = i;
		}
		for (int j = 0; i * pr[j] < N; ++j) {
			ws[i * pr[j]] = true;
			if (i % pr[j] == 0) {
				break;
			}
		}
	}
}

int p;

int calc(int x) {
	int k = 0;
	while (x) {
		k += x /= p;
	}
	return k;
}

int main() {
	sieve();
	int n, m;
	scanf("%d%d", &n, &m);
	int r = 1;
	for (int i = 0; i < cnt; ++i) {
		p = pr[i];
		int k = calc(n) - calc(m) - calc(n - m);
		while (k--) {
			r = r * (LL)p	 % mod;
		}
	}
	printf("%08d\n", r);
	return 0;
}
0