Wrong Answer
/in/foo.cc: In function 'll c(ll, ll)': /in/foo.cc:23:5: warning: unused variable 'ans' [-Wunused-variable] ll ans = ((fact[n]*ni(fact[m]))%mod)*ni(fact[n-m])%mod; ^~~ /in/foo.cc:24:1: warning: no return statement in function returning non-void [-Wreturn-type] } ^
代码
#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;
}
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;
}