結果

問題 No.2120 場合の数の下8桁
ユーザー 沙耶花沙耶花
提出日時 2022-11-04 21:43:21
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 1,376 ms / 2,000 ms
コード長 938 bytes
コンパイル時間 4,518 ms
コンパイル使用メモリ 260,580 KB
実行使用メモリ 81,728 KB
最終ジャッジ日時 2023-09-26 00:02:59
合計ジャッジ時間 15,202 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 301 ms
42,448 KB
testcase_01 AC 290 ms
42,448 KB
testcase_02 AC 291 ms
42,492 KB
testcase_03 AC 279 ms
42,424 KB
testcase_04 AC 295 ms
42,420 KB
testcase_05 AC 297 ms
42,436 KB
testcase_06 AC 1,120 ms
81,568 KB
testcase_07 AC 318 ms
42,496 KB
testcase_08 AC 275 ms
42,488 KB
testcase_09 AC 298 ms
42,532 KB
testcase_10 AC 309 ms
42,436 KB
testcase_11 AC 297 ms
44,496 KB
testcase_12 AC 313 ms
42,480 KB
testcase_13 AC 306 ms
42,720 KB
testcase_14 AC 316 ms
43,152 KB
testcase_15 AC 624 ms
62,868 KB
testcase_16 AC 1,376 ms
81,296 KB
testcase_17 AC 905 ms
81,348 KB
testcase_18 AC 277 ms
42,440 KB
testcase_19 AC 941 ms
81,728 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <atcoder/all>
#include <bits/stdc++.h>
using namespace std;
using namespace atcoder;
using mint = modint998244353;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf32 1000000001
#define Inf64 4000000000000000001

int dp[10000007];
int cnt[10000007];
int main(){
	
	for(int i=2;i<=10000003;i++){
		if(dp[i]!=0)continue;
		
		for(int j=i;j<=10000003;j+=i){
			dp[j] = i;
		}
		
	}
	
	int N,M;
	cin>>M>>N;
	
	long long ans = 0;
	if(M>=N){
		rep(i,N){
			{
				int cur = M-i;
				while(cur!=1){
					cnt[dp[cur]]++;
					cur /= dp[cur];
				}
			}
			{
				int cur = N-i;
				while(cur!=1){
					cnt[dp[cur]]--;
					cur /= dp[cur];
				}
			}
		}
		ans = 1;
		for(long long i=2;i<=10000000;i++){
			if(cnt[i]!=0){
				ans *= pow_mod(i,cnt[i],100000000);
				ans %= 100000000;
			}
		}
		
	}
	
	string Ans = to_string(ans);
	while(Ans.size()!=8)Ans.insert(Ans.begin(),'0');
	cout<<Ans<<endl;
	return 0;
}
0