QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#393487#6748. Spin the WheelwakakakaWA 0ms3808kbC++17972b2024-04-18 17:14:232024-04-18 17:14:24

Judging History

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

  • [2024-04-18 17:14:24]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3808kb
  • [2024-04-18 17:14:23]
  • 提交

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'