QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#211578#5749. Directed Vertex Cactisinsop90WA 0ms3656kbC++14585b2023-10-12 18:45:032023-10-12 18:45:04

Judging History

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

  • [2023-10-12 18:45:04]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3656kb
  • [2023-10-12 18:45:03]
  • 提交

answer

#include <bits/stdc++.h>
#define int long long
using namespace std;
const int mod = 1e9 + 9;
int n, m;
int ksm(int p, int q) {
	int res = 1;
	while(q) {
		if(q & 1) res = res * p % mod;
		p = p * p % mod;
		q >>= 1;
	}
	return res;
}
signed main() {
	ios::sync_with_stdio(0);
	cin.tie(0), cout.tie(0);
	cin >> n >> m;
	n = n * (n - 1) / 2;
	n %= mod;
	int fac = 1;
	for(int i = 1;i <= m;i++) fac = fac * i % mod;
	fac = ksm(fac, mod - 2);
	for(int i = n;i >= n - m + 1;i--) fac = fac * i % mod;
	for(int i = 1;i <= n;i++) fac = fac * i % mod;
	cout << fac;
} 

詳細信息

Test #1:

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

input:

3 1

output:

18

result:

ok 1 number(s): "18"

Test #2:

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

input:

4 4

output:

10800

result:

wrong answer 1st numbers differ - expected: '360', found: '10800'