QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#476649 | #2568. Mountains | DEMONKILLER | Compile Error | / | / | C++23 | 1.3kb | 2024-07-13 20:36:44 | 2024-07-13 20:36:45 |
Judging History
answer
#include<bits/stdc++.h>
#define N 310
#define mod 1000000007
using namespace std;
int n,m,K;
long long fac[N],inv[N],g[N][N];
long long res=1,qpow(long long a,int b){
long long Res=1;
while(b){
if(b&1)Res=Res*a%mod;
a=a*a%mod;
b>>=1;
}
return Res;
}
long long c(int a,int b){
return fac[a]*inv[b]%mod*inv[a-b]%mod;
}
int main(){
scanf("%d%d%d",&n,&m,&K);
fac[0]=fac[1]=1;
for(int i=2;i<=N-10;i++)fac[i]=fac[i-1]*i%mod;
inv[N-10]=qpow(fac[N-10],mod-2);
for(int i=N-11;i>=0;i--)inv[i]=inv[i+1]*(i+1)%mod;
for(int i=1;i<=K;i++)
for(int j=1;j<=K;j++)
g[i][j]=c(n+m,m+j-i);
for(int i=1;i<=K;i++){
int v=K+1;
for(int j=i;j<=K;j++){
if(g[j][i]){
v=j;
break;
}
}
if(v==K+1){
res=0;
break;
}
if(v!=i){
swap(g[v],g[i]);
res=mod-res;
}
int inv=qpow(g[i][i],mod-2);
for(int j=i+1;j<=K;j++){
long long mul=g[j][i]*inv%mod;
for(int k=i;k<=K;k++)
g[j][k]=(g[j][k]-g[i][k]*mul%mod+mod)%mod;
}
res=res*g[i][i]%mod;
}
printf("%lld",res);
}
详细
answer.code:7:40: error: a function-definition is not allowed here before ‘{’ token 7 | long long res=1,qpow(long long a,int b){ | ^ answer.code: In function ‘int main()’: answer.code:23:15: error: ‘qpow’ was not declared in this scope; did you mean ‘pow’? 23 | inv[N-10]=qpow(fac[N-10],mod-2); | ^~~~ | pow answer.code:20:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 20 | scanf("%d%d%d",&n,&m,&K); | ~~~~~^~~~~~~~~~~~~~~~~~~