QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#360531#6736. Alice and Bobsheppard23WA 1ms3536kbC++141.0kb2024-03-21 21:06:102024-03-21 21:06:11

Judging History

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

  • [2024-03-21 21:06:11]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3536kb
  • [2024-03-21 21:06:10]
  • 提交

answer

#include<iostream>
#include<algorithm>
#include<math.h>
#include<vector>
#include<set>
#include<cstring>
#include<map>
#include<unordered_map>
#include<queue>

#define x first
#define y second
#define int long long 
#define fast ios::sync_with_stdio(false);cin.tie(0);
#define Endl endl
using namespace std;
const int N = 1e7 + 10;
const int mod=998244353;
int fac[N];
int qmid(int a,int b)
{
    int res=1;
    while(b)
    {
        if(b&1)
        res=res*a%mod;
        a=a*a%mod;
        b>>=1;
    }
    return res;
}
void solve()
{
    int n;
    cin>>n;
    
    fac[0]=1;
    for(int i=1;i<=n;i++)
    {
        fac[i]=fac[i-1]*i%mod;
    }
    int ans=0;
    for(int i=1;n>=2*i-1;i++)
    {
        int t=fac[n-i]%mod*fac[n-i]%mod*qmid(fac[n-2*i+1],mod-2);
        ans=(ans+t%mod)%mod;
        cout<<ans<<endl;
    }
    
    cout<<ans<<endl;
}

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

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3536kb

input:

1

output:

1
1

result:

wrong answer Output contains longer sequence [length = 2], but answer contains 1 elements