QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#839427#1089. Biological Software UtilitiesyanshanjiahongAC ✓3ms3948kbC++141.1kb2025-01-01 19:04:592025-01-01 19:04:59

Judging History

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

  • [2025-01-01 19:04:59]
  • 评测
  • 测评结果:AC
  • 用时:3ms
  • 内存:3948kb
  • [2025-01-01 19:04:59]
  • 提交

answer

#include<bits/stdc++.h>
#define rep(i,j,k) for(int i=j;i<=k;i++)
#define repp(i,j,k) for(int i=j;i>=k;i--)
#define pii pair<int,int>
#define mp make_pair
#define fir first
#define sec second
#define ls(x) (x<<1)
#define rs(x) ((x<<1)|1)
#define lowbit(i) (i&-i)
#define int long long
using namespace std;
typedef long long ll;
const int N=50005,M=2e6+5,mo=998244353,inf=(ll)1e18+7;
const double PI=acos(-1);
void read(int &a){
    int x=0,w=1;
    char ch=getchar();
    while(!isdigit(ch)){
        if(ch=='-')w=-1;
        ch=getchar();
    }
    while(isdigit(ch)){
        x=(x<<3)+(x<<1)+ch-'0';
        ch=getchar();
    }
    a=x*w;
}
int n,m;
int quick_power(int base,int x){
    int res=1;
    while(x){
        if(x&1)res*=base,res%=mo;
        base*=base,base%=mo;
        x>>=1;
    }
    return res;
}
signed main(){
    read(n);
    if(n&1){
        puts("0");
        return 0;
    }
    if(n==2){
        puts("1");
        return 0;
    }
    m=n>>1;
    int ans=quick_power(n,m-2);
    rep(i,m+1,n)
        ans*=i,ans%=mo;
    printf("%lld\n",ans);
}

詳細信息

Test #1:

score: 100
Accepted
time: 1ms
memory: 3596kb

input:

1

output:

0

result:

ok 1 number(s): "0"

Test #2:

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

input:

2

output:

1

result:

ok 1 number(s): "1"

Test #3:

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

input:

3

output:

0

result:

ok 1 number(s): "0"

Test #4:

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

input:

4

output:

12

result:

ok 1 number(s): "12"

Test #5:

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

input:

7788

output:

178152092

result:

ok 1 number(s): "178152092"

Test #6:

score: 0
Accepted
time: 2ms
memory: 3800kb

input:

1000000

output:

178454094

result:

ok 1 number(s): "178454094"

Test #7:

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

input:

12346

output:

751958800

result:

ok 1 number(s): "751958800"

Test #8:

score: 0
Accepted
time: 3ms
memory: 3824kb

input:

999996

output:

690785929

result:

ok 1 number(s): "690785929"

Test #9:

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

input:

6

output:

720

result:

ok 1 number(s): "720"

Test #10:

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

input:

10

output:

30240000

result:

ok 1 number(s): "30240000"

Test #11:

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

input:

99

output:

0

result:

ok 1 number(s): "0"

Test #12:

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

input:

100

output:

934178078

result:

ok 1 number(s): "934178078"

Test #13:

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

input:

20

output:

245111072

result:

ok 1 number(s): "245111072"

Test #14:

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

input:

38745

output:

0

result:

ok 1 number(s): "0"

Test #15:

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

input:

3848

output:

928659530

result:

ok 1 number(s): "928659530"

Test #16:

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

input:

347835

output:

0

result:

ok 1 number(s): "0"

Test #17:

score: 0
Accepted
time: 1ms
memory: 3816kb

input:

234234

output:

745247398

result:

ok 1 number(s): "745247398"

Test #18:

score: 0
Accepted
time: 1ms
memory: 3944kb

input:

12

output:

818069491

result:

ok 1 number(s): "818069491"

Test #19:

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

input:

98

output:

648803799

result:

ok 1 number(s): "648803799"

Test #20:

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

input:

124

output:

159487965

result:

ok 1 number(s): "159487965"

Test #21:

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

input:

1024

output:

318674437

result:

ok 1 number(s): "318674437"

Test #22:

score: 0
Accepted
time: 2ms
memory: 3732kb

input:

524288

output:

495260023

result:

ok 1 number(s): "495260023"

Test #23:

score: 0
Accepted
time: 1ms
memory: 3560kb

input:

524289

output:

0

result:

ok 1 number(s): "0"

Test #24:

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

input:

999999

output:

0

result:

ok 1 number(s): "0"

Test #25:

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

input:

999997

output:

0

result:

ok 1 number(s): "0"