QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#408271#6736. Alice and BobmxxnezWA 0ms3668kbC++17674b2024-05-09 22:12:512024-05-09 22:12:51

Judging History

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

  • [2024-05-09 22:12:51]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3668kb
  • [2024-05-09 22:12:51]
  • 提交

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;
    if(n == 1) {cout << "1\n";return ;}
	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: 100
Accepted
time: 0ms
memory: 3512kb

input:

1

output:

1

result:

ok 1 number(s): "1"

Test #2:

score: 0
Accepted
time: 0ms
memory: 3572kb

input:

2

output:

1

result:

ok 1 number(s): "1"

Test #3:

score: 0
Accepted
time: 0ms
memory: 3560kb

input:

10

output:

997920

result:

ok 1 number(s): "997920"

Test #4:

score: -100
Wrong Answer
time: 0ms
memory: 3668kb

input:

100

output:

632386190

result:

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