QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#367179 | #6736. Alice and Bob | whopxx | WA | 0ms | 3728kb | C++20 | 928b | 2024-03-25 19:59:59 | 2024-03-25 19:59:59 |
Judging History
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;
}
Details
Tip: Click on the bar to expand more detailed information
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'