/ Randle /

记录详情

Accepted


  
# 状态 耗时 内存占用
#1 Accepted 3ms 372.0 KiB
#2 Accepted 3ms 384.0 KiB
#3 Accepted 3ms 384.0 KiB
#4 Accepted 3ms 360.0 KiB
#5 Accepted 3ms 368.0 KiB
#6 Accepted 3ms 384.0 KiB
#7 Accepted 5ms 1.25 MiB
#8 Accepted 5ms 1.336 MiB
#9 Accepted 6ms 1.855 MiB
#10 Accepted 5ms 1.227 MiB

代码

#include <stdio.h>
#include <iostream>
using namespace std;
typedef long long ll;
const ll mod = 1e9+7;
ll fact[200005];
ll quickPow(ll a,ll k){
	ll ret = 1,mc = a;
	while(k!=0){
		if(k&1){
			ret=ret*mc%mod;
			k--;
		}
		k = k/2; 
		mc = mc*mc%mod;
	}
	return ret%mod;
}
ll ni(ll a){
	return quickPow(a,mod-2);
}
ll c(ll n,ll m){
	ll ans = ((fact[n]*ni(fact[m]))%mod)*ni(fact[n-m])%mod;
	return ans;
}
int main(){
	ll n,m;
	cin>>n>>m;
	fact[0] = 1;
	for(int i = 1;i<=n;i++){
		fact[i] = fact[i-1]*i%mod;
	}
	cout<<c(n,m);
	return 0;
}

信息

递交者
类型
递交
题目
电影 T1
题目数据
下载
语言
C++
递交时间
2017-10-15 18:27:21
评测时间
2017-10-15 18:27:21
评测机
分数
100
总耗时
43ms
峰值内存
1.855 MiB