結果

問題 No.2120 場合の数の下8桁
コンテスト
ユーザー id-ord
提出日時 2026-01-05 23:19:55
言語 C++23
(gcc 15.2.0 + boost 1.89.0)
結果
WA  
実行時間 -
コード長 491 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 5,264 ms
コンパイル使用メモリ 206,740 KB
実行使用メモリ 7,852 KB
最終ジャッジ日時 2026-01-05 23:20:05
合計ジャッジ時間 9,722 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 1 WA * 19
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <iostream>
#include <print>
int main(){
	int64_t p2=0,p5=0,ans=1,N,M,e8=100000000;
	std::cin>>N>>M;
	if(N>M){std::cout<<"00000000";return 0;}
	for(;N;M--,N--){
		int m=M,n=N,n_=1,t=39999999;
		while(m%2==0){m/=2;p2++;}while(m%5==0){m/=5;p5++;}
		while(n%2==0){n/=2;p2--;}while(n%5==0){n/=5;p5--;}
		while(t){if(n%2)n_*=n;n*=n;n_%=e8;n%=e8;t/=2;}
		ans*=m;ans%=e8;
		ans*=n_;ans%=e8;
	}
	while(p2--){ans*=2;ans%=e8;}while(p5--){ans*=5;ans%=e8;}
	std::print("{:08}",ans);
	return 0;
}
0