const int p=998244353;
template<class _Tp,class _tp>void add(_Tp&x,const _tp& y){((x+=y)>=p)&&(x-=p);}template<class _Tp,class _tp>_Tp Add(_Tp x,const _tp y){add(x,y);return x;}
template<class _Tp,class _tp>void sub(_Tp&x,const _tp&y){((x-=y)<0)&&(x+=p);}template<class _Tp,class _tp>_Tp Sub(_Tp x,const _tp y){sub(x,y);return x;}
template<class _Tp,class _tp>void mul(_Tp&x,const _tp&y){x=1ll*x*y%p;}template<class _Tp,class _tp>_Tp Mul(const _Tp x,const _tp y){return 1ll*x*y%p;}
template<class _Tp,class _tp>_Tp ksm(_Tp a,_tp b){_Tp ans(1);for(;b;b>>=1,mul(a,a))if(b&1)mul(ans,a);return ans;}
template<class _Tp>_Tp div2(_Tp a){if(a&1)a+=p;return a>>1;}
int Lagelangrichazhi(vector<pair<int,int> >a,int k){
int n=a.size();
int ans=0;
for(int i=0;i<n;i++){
int fz=a[i].second,fm=1;
for(int j=0;j<n;j++)if(i!=j){
mul(fz,Sub(k,a[j].first));
mul(fm,Sub(a[i].first,a[j].first));
}
add(ans,Mul(fz,ksm(fm,p-2)));
}
return ans;
}剪贴板
剪贴板 r6al45zq
剪贴板信息
剪贴板信息
- 发布
- 收录
- 更新