QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#367150#6736. Alice and BobBerlin_JacorCompile Error//C++142.3kb2024-03-25 19:27:472024-03-25 19:27:47

Judging History

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

  • [2024-03-25 19:27:47]
  • 评测
  • [2024-03-25 19:27:47]
  • 提交

answer

#include<bits/stdc++.h>
//#include<ext/rope>
//#include<bits/extc++.h>
//using namespace __gnu_cxx;
//using namespace __gnu_pbds;
using namespace std;
const int mod = 998244353;
int qpow(int x,int y) {
    long long res=1;
    while(y){
        if(y&1)res=res*x%mod;
        x=1ll*x*x%mod;
        y>>=1;
    }
    return res;
}
void solve()
{
    int n;
    cin >> n;
    long long ans = 0;
    const int p = 998244353;
    vi lc(n + 10, 0);
    lc[0] = 1;
    for (int i = 1; i <= n; ++i) {
        lc[i] = 1ll*lc[i - 1] * i % p;
    }

    for (int i = 1; n - 2 * i + 1 >= 0; ++i) {
            ans = (ans + 1ll*lc[n-i] * lc[n-i] % p * qpow(lc[n-2*i+1],p-2) % p) % p ;
    }
    cout << ans << "\n";
}

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    //cout<<fixed<<setprecision(2);
//    clock_t tStart=clock();
    //SetIO("main");
//    freopen("data3.in","r",stdin);
//    freopen("out.txt","w",stdout);
    //Prime();
    int T = 1;
    //cin >> T;
    while(T--) {
        solve();
    }
    //cerr<<"\nTime Taken: ";
    //cerr<<fixed<<setprecision(0)<<(double)(clock() - tStart)/CLOCKS_PER_SEC;
}
/*
*/
//#        ┏┓   ┏┓+ +
//#   ┏┛┻━━━┛┻┓ + +
//#   ┃       ┃  
//#   ┃   ━   ┃ ++ + + +
//#   ████━████ ┃+
//#   ┃       ┃ +
//#   ┃   ┻   ┃
//#   ┃       ┃ + +
//#   ┗━┓   ┏━┛
//#     ┃   ┃           
//#     ┃   ┃ + + + +
//#     ┃   ┃     
//#     ┃   ┃ +     gmy保佑,一发过,不能再痒了
//#     ┃   ┃
//#     ┃   ┃  +         
//#     ┃    ┗━━━┓ + +
//#     ┃        ┣┓
//#     ┃        ┏┛
//#     ┗┓┓┏━┳┓┏┛ + + + +
//#      ┃┫┫ ┃┫┫
//#      ┗┻┛ ┗┻┛+ + + +
//————————————————————————————————

Details

answer.code: In function ‘void solve()’:
answer.code:23:5: error: ‘vi’ was not declared in this scope
   23 |     vi lc(n + 10, 0);
      |     ^~
answer.code:24:5: error: ‘lc’ was not declared in this scope
   24 |     lc[0] = 1;
      |     ^~