QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#35778 | #1089. Biological Software Utilities | Froggygua | AC ✓ | 10ms | 11400kb | C++17 | 799b | 2022-06-19 11:10:33 | 2022-06-19 11:10:33 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define N 1000010
const int mod=998244353;
typedef long long ll;
int n,fac[N],ifac[N];
int qpow(int a,int b){
int ans=1;
while(b){
if(b&1)ans=1LL*ans*a%mod;
a=1LL*a*a%mod;
b>>=1;
}
return ans;
}
void init(int n){
fac[0]=1;
for(int i=1;i<=n;++i){
fac[i]=1LL*fac[i-1]*i%mod;
}
ifac[n]=qpow(fac[n],mod-2);
for(int i=n-1;i>=0;--i){
ifac[i]=1LL*ifac[i+1]*(i+1)%mod;
}
}
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
cin>>n;
if(n&1){
cout<<0<<'\n';
return 0;
}
init(n);
n>>=1;
if(n==1){
cout<<1<<'\n';
return 0;
}
int ans=qpow(n,n-2);
ans=1LL*ans*fac[n<<1]%mod;
ans=1LL*ans*qpow(ifac[2],n)%mod*ifac[n]%mod;
ans=1LL*ans*qpow(4,n-1)%mod;
cout<<ans<<'\n';
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 3ms
memory: 3564kb
input:
1
output:
0
result:
ok 1 number(s): "0"
Test #2:
score: 0
Accepted
time: 2ms
memory: 5624kb
input:
2
output:
1
result:
ok 1 number(s): "1"
Test #3:
score: 0
Accepted
time: 2ms
memory: 3508kb
input:
3
output:
0
result:
ok 1 number(s): "0"
Test #4:
score: 0
Accepted
time: 3ms
memory: 5596kb
input:
4
output:
12
result:
ok 1 number(s): "12"
Test #5:
score: 0
Accepted
time: 0ms
memory: 5664kb
input:
7788
output:
178152092
result:
ok 1 number(s): "178152092"
Test #6:
score: 0
Accepted
time: 9ms
memory: 11380kb
input:
1000000
output:
178454094
result:
ok 1 number(s): "178454094"
Test #7:
score: 0
Accepted
time: 2ms
memory: 5600kb
input:
12346
output:
751958800
result:
ok 1 number(s): "751958800"
Test #8:
score: 0
Accepted
time: 10ms
memory: 11400kb
input:
999996
output:
690785929
result:
ok 1 number(s): "690785929"
Test #9:
score: 0
Accepted
time: 2ms
memory: 5620kb
input:
6
output:
720
result:
ok 1 number(s): "720"
Test #10:
score: 0
Accepted
time: 2ms
memory: 5640kb
input:
10
output:
30240000
result:
ok 1 number(s): "30240000"
Test #11:
score: 0
Accepted
time: 2ms
memory: 3656kb
input:
99
output:
0
result:
ok 1 number(s): "0"
Test #12:
score: 0
Accepted
time: 2ms
memory: 5692kb
input:
100
output:
934178078
result:
ok 1 number(s): "934178078"
Test #13:
score: 0
Accepted
time: 2ms
memory: 5640kb
input:
20
output:
245111072
result:
ok 1 number(s): "245111072"
Test #14:
score: 0
Accepted
time: 2ms
memory: 3548kb
input:
38745
output:
0
result:
ok 1 number(s): "0"
Test #15:
score: 0
Accepted
time: 2ms
memory: 5636kb
input:
3848
output:
928659530
result:
ok 1 number(s): "928659530"
Test #16:
score: 0
Accepted
time: 2ms
memory: 3564kb
input:
347835
output:
0
result:
ok 1 number(s): "0"
Test #17:
score: 0
Accepted
time: 5ms
memory: 10248kb
input:
234234
output:
745247398
result:
ok 1 number(s): "745247398"
Test #18:
score: 0
Accepted
time: 2ms
memory: 5764kb
input:
12
output:
818069491
result:
ok 1 number(s): "818069491"
Test #19:
score: 0
Accepted
time: 2ms
memory: 5724kb
input:
98
output:
648803799
result:
ok 1 number(s): "648803799"
Test #20:
score: 0
Accepted
time: 3ms
memory: 5704kb
input:
124
output:
159487965
result:
ok 1 number(s): "159487965"
Test #21:
score: 0
Accepted
time: 2ms
memory: 5700kb
input:
1024
output:
318674437
result:
ok 1 number(s): "318674437"
Test #22:
score: 0
Accepted
time: 8ms
memory: 10208kb
input:
524288
output:
495260023
result:
ok 1 number(s): "495260023"
Test #23:
score: 0
Accepted
time: 2ms
memory: 3620kb
input:
524289
output:
0
result:
ok 1 number(s): "0"
Test #24:
score: 0
Accepted
time: 2ms
memory: 3712kb
input:
999999
output:
0
result:
ok 1 number(s): "0"
Test #25:
score: 0
Accepted
time: 1ms
memory: 3572kb
input:
999997
output:
0
result:
ok 1 number(s): "0"