QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#393487 | #6748. Spin the Wheel | wakakaka | WA | 0ms | 3808kb | C++17 | 972b | 2024-04-18 17:14:23 | 2024-04-18 17:14:24 |
Judging History
answer
#include <bits/stdc++.h>
#define int long long
#define endl '\n'
#define PSI pair<string,int>
#define double long double
const int mod=998244353;
using namespace std;
int ksm(int a,int b){
int ans=1;
while(b){
if(b&1) {
ans*=a;
ans%=mod;
}
a*=a;
a%=mod;
b>>=1;
}
return ans;
}
void solve() {
int n;
cin>>n;
vector<int>fac(n+1);
int ans=0;
fac[0]=1;
for (int i = 1; i <=n ; ++i) {
fac[i]=(fac[i-1]*i)%mod;
}
for (int i = 1; i <n ; ++i) {
int res=fac[n-i]%mod;
res%=mod;
res*=ksm(fac[(n-2*i)+1],mod-2)%mod;
res%=mod;
res*=fac[n-i];
res%=mod;
ans+=res;
ans%=mod;
}
cout<<ans<<endl;
}
signed main() {
ios::sync_with_stdio(0);
cin.tie(0) , cout.tie(0);
int T = 1;
//cin >> T ;
while(T--) solve();
return 0;
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3808kb
input:
5 1 3 0 2 4
output:
46
result:
wrong answer 1st numbers differ - expected: '3', found: '46'