結果

問題 No.129 お年玉(2)
ユーザー めうめう🎒
提出日時 2016-03-30 21:57:33
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
RE  
実行時間 -
コード長 792 bytes
コンパイル時間 627 ms
コンパイル使用メモリ 73,212 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-02 08:17:24
合計ジャッジ時間 7,938 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 4 WA * 1 RE * 41
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;

#define ll long long
#define INF (1 << 30)
#define INFLL (1LL << 60)

unsigned ll kai(unsigned ll num){
	unsigned ll ans = num % 1000000000;
	for(unsigned ll i = ans - 1;i >= 1;i--){
		ans %= 1000000000;
		ans *= i;
	}
	ans %= 1000000000;
	return ans;
}

unsigned ll mCn(unsigned ll m,unsigned ll n){
	unsigned ll ans = kai(m) / (kai(m-n) * kai(n));
	return ans ;
}

int main() {
	unsigned ll n,m,amari;
	cin >> n >> m;
	amari = n % (1000 * m);
	amari = amari / 1000 * 1000;
	amari /= 1000;
	if(amari == 0) cout << 1 << endl;
	else cout << mCn(m,amari) << endl;
	return 0;
}
0