QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#764971#8023. The Journey of Geor AutumnlarryyuCompile Error//C++20863b2024-11-20 11:25:272024-11-20 11:25:29

Judging History

This is the latest submission verdict.

  • [2024-11-20 11:25:29]
  • Judged
  • [2024-11-20 11:25:27]
  • Submitted

answer

#include<bits/stdc++.h>
using namespace std;
#define int long long
const int mo=998244353;
int n,k;
int f[10000010],s[10000010];
int fac[10000010],inv[10000010];
int po(int x,int y){
	int z=1;
	while(y){
		if(y%2) z=z*x%mo;
		x=x*x%mo;
		y/=2;
	}
	return z;
}
struct Mod{
	int m,p;
	void init(int pp){
		m=((__int128)1ll<<64)/pp;p=pp;
	}
	int operator()(int x){
		return x-((__int128(x)*m)>>64)*p;
	}
}mod;
signed main(){
	ios::sync_with_stdio(0);
	cin.tie(nullptr);
	mod.init(998244353);
	cin>>n>>k;
	fac[0]=inv[0]=1;
	for(int i=1;i<=n;i++){
		fac[i]=mod(fac[i-1]*i);
	}
	inv[n]=po(fac[n],mo-2);
	for(int i=n-1;i;i--){
		inv[i]=mod(inv[i+1]*(i+1))
	}
	s[0]=fac[n-1];
	for(int i=1;i<=n;i++){
		f[i]=mod((i<=k?s[i-1]:mod(s[i-1]-s[i-k-1]))*inv[n-i]);
		s[i]=mod(s[i-1]+mod(f[i]*fac[n-i-1]));
	}
	cout<<f[n];
	return 0;
}

詳細信息

answer.code: In function ‘int main()’:
answer.code:37:43: error: expected ‘;’ before ‘}’ token
   37 |                 inv[i]=mod(inv[i+1]*(i+1))
      |                                           ^
      |                                           ;
   38 |         }
      |         ~