QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#408267#6736. Alice and BobmxxnezWA 1ms3524kbC++17633b2024-05-09 22:09:132024-05-09 22:09:20

Judging History

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

  • [2024-05-09 22:09:20]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3524kb
  • [2024-05-09 22:09:13]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define i64 long long 
const i64 MOD = 998244353;
const i64 N = 1e7 + 7;
i64 fac[N];
void solve(){
    i64 n;
    cin >> n;
	fac[1] = 1;
	for(i64 i = 2 ; i <= n ; i++){
		fac[i] = fac[i-1] * i % MOD;
	}
	i64 ans = 0 ;
	i64 on = n - 1;
	i64 un = n - 1;
	for(i64 i = n - 1 ; i >= (1+n)/2; i--){
		ans = (ans + (fac[on] / fac[un])  * fac[i]) % MOD ;
		on -- ;
		un = un - 2;
	}
	cout << ans << "\n";
}
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t=1;
    //cin>>t;
    while(t--){
        solve();
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

1

output:

0

result:

wrong answer 1st numbers differ - expected: '1', found: '0'