QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#367179#6736. Alice and BobwhopxxWA 0ms3728kbC++20928b2024-03-25 19:59:592024-03-25 19:59:59

Judging History

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

  • [2024-03-25 19:59:59]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3728kb
  • [2024-03-25 19:59:59]
  • 提交

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(int n){
    a[0] = 1;
    for(int i = 1; i <= n; 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;
    return a[n] / a[n - m];
}

void solve(){
    int n;
    cin >> n;
    init(n + 1);
    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 << '\n';
}

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

详细

Test #1:

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

input:

1

output:

1

result:

ok 1 number(s): "1"

Test #2:

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

input:

2

output:

1

result:

ok 1 number(s): "1"

Test #3:

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

input:

10

output:

997920

result:

ok 1 number(s): "997920"

Test #4:

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

input:

100

output:

632386190

result:

wrong answer 1st numbers differ - expected: '188898954', found: '632386190'