QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#207903#5749. Directed Vertex Cactixia_mcWA 0ms1596kbC++14723b2023-10-08 22:16:462023-10-08 22:16:46

Judging History

你现在查看的是最新测评结果

  • [2023-10-08 22:16:46]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:1596kb
  • [2023-10-08 22:16:46]
  • 提交

answer

#include<stdio.h>

#define int long long 

const int N=3e7+5,mod=1e9+9;
int ksm(int x,int y){
	int s=1;
	while(y){
		if(y&1) (s*=x%mod)%=mod;
		(x*=x%mod)%=mod;y>>=1;
	}
	return s;
}
// int fact[N];
int fact(int x){int s=1;for(int i=2;i<=x;i++) s*=i;return s;}
int inv(int x){return ksm(x,mod-2);}
// void init(){fact[0]=1;for(int i=1;i<=mod;i++) fact[i]=fact[i-1]*i%mod;}
int C(int n,int m){
	return fact(n)*inv(fact(n-m))%mod*(inv(fact(m)))%mod;
}
int lucas(int n,int m){
	if(m==0) return 1;
	if(n==0) return 1;
	return C(n%mod,m%mod)%mod*lucas(n/mod,m/mod)%mod;
}
int n,m;
signed main(){
	// init();
	scanf("%lld%lld",&n,&m);
	printf("%lld\n",fact(n)*lucas(lucas(n,2),m)%mod);
	return 0;
}

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 1512kb

input:

3 1

output:

18

result:

ok 1 number(s): "18"

Test #2:

score: 0
Accepted
time: 0ms
memory: 1576kb

input:

4 4

output:

360

result:

ok 1 number(s): "360"

Test #3:

score: -100
Wrong Answer
time: 0ms
memory: 1596kb

input:

39847 348708

output:

0

result:

wrong answer 1st numbers differ - expected: '983575456', found: '0'