题解:
一个奇怪的公式...
代码:
#include<bits/stdc++.h>
#define ll long long
using namespace std;
struct aaa{
ll x,y;
}a[10001];
ll n,m,ans,p=998244353;
ll ksm(ll x,ll y){
ll hh=1;
while(y){
if(y&1)hh=(hh*x)%p;
x=(x*x)%p;
y/=2;
}
return hh;
}
int main(){
ll i,j,now;
scanf("%lld%lld",&n,&m);
for(i=1;i<=n;i++){
scanf("%lld%lld",&a[i].x,&a[i].y);
}
for(i=1;i<=n;i++){
now=1;
for(j=1;j<=n;j++)
if(i!=j)now=now*(a[i].x-a[j].x+p)%p;
now=ksm(now,p-2);
for(j=1;j<=n;j++)
if(i!=j)now=now*(m-a[j].x+p)%p;
now=now*a[i].y%p;
ans=(ans+now)%p;
}
printf("%lld",ans);
}