結果

問題 No.2120 場合の数の下8桁
ユーザー daiotadaiota
提出日時 2022-11-04 23:15:10
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 546 bytes
コンパイル時間 2,230 ms
コンパイル使用メモリ 166,408 KB
実行使用メモリ 4,500 KB
最終ジャッジ日時 2023-09-26 01:43:51
合計ジャッジ時間 3,480 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,384 KB
testcase_04 WA -
testcase_05 AC 2 ms
4,380 KB
testcase_06 WA -
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 2 ms
4,384 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 1 ms
4,376 KB
testcase_19 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

#define REP(i,n) for(int i=0;i<int(n);i++)
typedef long long ll;
typedef pair<int,int> P;

int main(void){
	ll i,j;

	cin.tie(0);  ios_base::sync_with_stdio(false);

	ll M,N;
	cin >> M >> N;

	if(M<N){
		cout << "00000000" << endl;
		return 0;
	}

	ll a=1;
	for(i=1;i<=N;i++){
		a=a*(M-i+1)/i;
		if(a>100000000000000000) a=a%(100000000000);
	}

	string s=to_string(a);
	ll n=s.size();
	if(n<=8LL){
		REP(i,8-n) cout << 0;
		cout << a << endl;
	}
	else cout << a%100000000 << endl;




	return 0;
}
0