QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#208620 | #5749. Directed Vertex Cacti | czc | WA | 0ms | 3716kb | C++14 | 568b | 2023-10-09 19:26:06 | 2023-10-09 19:26:07 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define int long long
int n,m;
const int mod=1e9+7;
inline int qpow(int a,int b){
int ret=1;
for( ; b; b>>=1){
if(b&1) ret=ret*a%mod;
a=a*a%mod;
}
return ret;
}
inline int C(int x,int y){
if(x<y) return 0;
int ret=1ll,inv=1ll;
for(int i=max(x-y,y)+1;i<=x;i++) ret=ret*i%mod;
for(int i=1;i<=min(x-y,y);i++) inv=inv*i%mod;
return ret*qpow(inv,mod-2)%mod;
}
signed main(){
cin>>n>>m;
int ans=1;
for(int i=1;i<=n;i++) ans=ans*i%mod;
ans=ans*C(C(n,2),m)%mod;
cout<<ans;
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3656kb
input:
3 1
output:
18
result:
ok 1 number(s): "18"
Test #2:
score: 0
Accepted
time: 0ms
memory: 3648kb
input:
4 4
output:
360
result:
ok 1 number(s): "360"
Test #3:
score: -100
Wrong Answer
time: 0ms
memory: 3716kb
input:
39847 348708
output:
448520477
result:
wrong answer 1st numbers differ - expected: '983575456', found: '448520477'