QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#839188#1089. Biological Software UtilitiesyqrAC ✓26ms32852kbC++231.6kb2025-01-01 14:28:162025-01-01 14:28:17

Judging History

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

  • [2025-01-01 14:28:17]
  • 评测
  • 测评结果:AC
  • 用时:26ms
  • 内存:32852kb
  • [2025-01-01 14:28:16]
  • 提交

answer

#include<stdio.h>
#include<ctype.h>
namespace IO {
	constexpr int bufsize = 230005;
	char buf[bufsize], *f1, *f2;
	char gtchar() {return f1 == f2 && (f2 = buf + fread(f1 = buf, 1, bufsize, stdin)) == buf? EOF: *f1++;}
	template<typename T> void read(T &ret)
	{
		int f = ret = 0;
		char ch = gtchar();
		while(!isdigit(ch)) f = ch == '-', ch = gtchar();
		while(isdigit(ch)) ret = (ret << 3) + (ret << 1) + (ch ^ 48), ch = gtchar();
		if(f) ret = -ret;
	}
	template<typename T, typename ...t> void read(T &a, t &...b) {read(a), read(b...);}
}using IO::read;
typedef long long ll;
typedef unsigned long long ull;
constexpr int maxn = 1000005, mod = 998244353;
ll fac[maxn << 1], inv[maxn << 1];
#define Mul(a, b) ((a) * (b) % mod)
ll Add(ll a, ll b) {return (a += b) >= mod? a - mod: a;}
ll Dec(ll a, ll b) {return (a -= b) < 0? a + mod: a;}

void init()
{
	fac[0] = fac[1] = inv[0] = inv[1] = 1;
	for(int i = 2; i < (maxn << 1); i++)
		fac[i] = Mul(fac[i - 1], i),
		inv[i] = Dec(mod, Mul(mod / i, inv[mod % i]));
	for(int i = 2; i < (maxn << 1); i++) inv[i] = Mul(inv[i - 1], inv[i]);
}
ll qpow(ll a, ll b)
{
	ll ret = 1;
	while(b)
	{
		if(b & 1) ret = Mul(ret, a);
		a = Mul(a, a);
		b >>= 1;
	}
	return ret;
}
#define inv(x) (qpow(x, mod - 2))

int n;
int main()
{
	// freopen(".in", "r", stdin);
	// freopen(".out", "w", stdout);
	init();
	read(n);
	if(n & 1) return puts("0"), 0;
	if(n == 2) return puts("1"), 0;
	n >>= 1;
	ll tmp = Mul(Mul(fac[n << 1], inv[n]), qpow(n, n - 2));
	printf("%lld\n", Mul(tmp, qpow(2, n - 2)));
	return 0;
}

详细

Test #1:

score: 100
Accepted
time: 16ms
memory: 32556kb

input:

1

output:

0

result:

ok 1 number(s): "0"

Test #2:

score: 0
Accepted
time: 26ms
memory: 32564kb

input:

2

output:

1

result:

ok 1 number(s): "1"

Test #3:

score: 0
Accepted
time: 17ms
memory: 32468kb

input:

3

output:

0

result:

ok 1 number(s): "0"

Test #4:

score: 0
Accepted
time: 20ms
memory: 32852kb

input:

4

output:

12

result:

ok 1 number(s): "12"

Test #5:

score: 0
Accepted
time: 16ms
memory: 32716kb

input:

7788

output:

178152092

result:

ok 1 number(s): "178152092"

Test #6:

score: 0
Accepted
time: 11ms
memory: 32752kb

input:

1000000

output:

178454094

result:

ok 1 number(s): "178454094"

Test #7:

score: 0
Accepted
time: 20ms
memory: 32852kb

input:

12346

output:

751958800

result:

ok 1 number(s): "751958800"

Test #8:

score: 0
Accepted
time: 16ms
memory: 32720kb

input:

999996

output:

690785929

result:

ok 1 number(s): "690785929"

Test #9:

score: 0
Accepted
time: 17ms
memory: 32752kb

input:

6

output:

720

result:

ok 1 number(s): "720"

Test #10:

score: 0
Accepted
time: 12ms
memory: 32740kb

input:

10

output:

30240000

result:

ok 1 number(s): "30240000"

Test #11:

score: 0
Accepted
time: 17ms
memory: 32580kb

input:

99

output:

0

result:

ok 1 number(s): "0"

Test #12:

score: 0
Accepted
time: 24ms
memory: 32720kb

input:

100

output:

934178078

result:

ok 1 number(s): "934178078"

Test #13:

score: 0
Accepted
time: 23ms
memory: 32752kb

input:

20

output:

245111072

result:

ok 1 number(s): "245111072"

Test #14:

score: 0
Accepted
time: 15ms
memory: 32492kb

input:

38745

output:

0

result:

ok 1 number(s): "0"

Test #15:

score: 0
Accepted
time: 10ms
memory: 32752kb

input:

3848

output:

928659530

result:

ok 1 number(s): "928659530"

Test #16:

score: 0
Accepted
time: 13ms
memory: 32468kb

input:

347835

output:

0

result:

ok 1 number(s): "0"

Test #17:

score: 0
Accepted
time: 19ms
memory: 32808kb

input:

234234

output:

745247398

result:

ok 1 number(s): "745247398"

Test #18:

score: 0
Accepted
time: 16ms
memory: 32720kb

input:

12

output:

818069491

result:

ok 1 number(s): "818069491"

Test #19:

score: 0
Accepted
time: 20ms
memory: 32744kb

input:

98

output:

648803799

result:

ok 1 number(s): "648803799"

Test #20:

score: 0
Accepted
time: 16ms
memory: 32716kb

input:

124

output:

159487965

result:

ok 1 number(s): "159487965"

Test #21:

score: 0
Accepted
time: 10ms
memory: 32768kb

input:

1024

output:

318674437

result:

ok 1 number(s): "318674437"

Test #22:

score: 0
Accepted
time: 16ms
memory: 32844kb

input:

524288

output:

495260023

result:

ok 1 number(s): "495260023"

Test #23:

score: 0
Accepted
time: 17ms
memory: 32544kb

input:

524289

output:

0

result:

ok 1 number(s): "0"

Test #24:

score: 0
Accepted
time: 20ms
memory: 32564kb

input:

999999

output:

0

result:

ok 1 number(s): "0"

Test #25:

score: 0
Accepted
time: 16ms
memory: 32484kb

input:

999997

output:

0

result:

ok 1 number(s): "0"