QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#367173#6736. Alice and BobwhopxxTL 265ms81764kbC++14968b2024-03-25 19:52:222024-03-25 19:52:25

Judging History

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

  • [2024-03-25 19:52:25]
  • 评测
  • 测评结果:TL
  • 用时:265ms
  • 内存:81764kb
  • [2024-03-25 19:52:22]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define int long long
const int mod = 998244353;
const int N = 1e7 + 10;
int a[N];

void init(){
    a[0] = 1;
    for(int i = 1; i <= 1e7 + 2; i++){
        a[i] = a[i - 1] * i % mod;
    }
}

int ksm(int a,int b){
    int res = 1;
    while(b){
        if(b & 1){
            res = res * a % mod;
        }
        a = a * a % mod;
        b >>= 1;
    }
    return res % mod;
}

int A(int n,int m){

    if(n - m < 0)return 0;
    return a[n] * ksm(a[n - m], mod - 2) % mod;
}

void solve(){
    init();
    // cout <<a[4] << endl;
    // A(4, 4) = a[4] / a[0]; 
    int n = 10;
    cin >> n;
    int ans = 0;
    for(int x = 1; x <= n; x++){
        ans += A(n - x,x - 1) * A(n - x,n - x) % mod;
        ans %= mod;
    }
    cout << ans % mod << endl;
    
}

signed main(){

    int _(1);
    // cin >> _;
    while(_ --){
        solve();
    }
    return 0;
}

详细

Test #1:

score: 100
Accepted
time: 51ms
memory: 81732kb

input:

1

output:

1

result:

ok 1 number(s): "1"

Test #2:

score: 0
Accepted
time: 38ms
memory: 81764kb

input:

2

output:

1

result:

ok 1 number(s): "1"

Test #3:

score: 0
Accepted
time: 42ms
memory: 81656kb

input:

10

output:

997920

result:

ok 1 number(s): "997920"

Test #4:

score: 0
Accepted
time: 39ms
memory: 81672kb

input:

100

output:

188898954

result:

ok 1 number(s): "188898954"

Test #5:

score: 0
Accepted
time: 31ms
memory: 81612kb

input:

4

output:

10

result:

ok 1 number(s): "10"

Test #6:

score: 0
Accepted
time: 31ms
memory: 81672kb

input:

8

output:

12336

result:

ok 1 number(s): "12336"

Test #7:

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

input:

16

output:

373118483

result:

ok 1 number(s): "373118483"

Test #8:

score: 0
Accepted
time: 45ms
memory: 81724kb

input:

32

output:

314585464

result:

ok 1 number(s): "314585464"

Test #9:

score: 0
Accepted
time: 55ms
memory: 81724kb

input:

64

output:

627827331

result:

ok 1 number(s): "627827331"

Test #10:

score: 0
Accepted
time: 33ms
memory: 81760kb

input:

128

output:

828497685

result:

ok 1 number(s): "828497685"

Test #11:

score: 0
Accepted
time: 28ms
memory: 81640kb

input:

256

output:

65697890

result:

ok 1 number(s): "65697890"

Test #12:

score: 0
Accepted
time: 47ms
memory: 81756kb

input:

512

output:

854187619

result:

ok 1 number(s): "854187619"

Test #13:

score: 0
Accepted
time: 41ms
memory: 81608kb

input:

1024

output:

513823539

result:

ok 1 number(s): "513823539"

Test #14:

score: 0
Accepted
time: 265ms
memory: 81720kb

input:

1361956

output:

617368199

result:

ok 1 number(s): "617368199"

Test #15:

score: -100
Time Limit Exceeded

input:

7579013

output:


result: