50分代码求调qwq
查看原帖
50分代码求调qwq
327444
3a51_楼主2022/2/9 15:33

Rt.经过上次大佬的指点,我成功的将代码调到了50分

#include<bits/stdc++.h>
#define int long long
using namespace std;
const int MAXN=100005;
const int Mod=998244353;
int n,k,a[MAXN],b[MAXN],suma,sumb,sumc,ans,ansa;
int fastpower(int b,int p)
{
	int ans=1;
	if(p==0)	return 1%Mod;
	while(p)
	{
		if(p%2==1)
			ans=ans*b%Mod,p--;
		b=b*b%Mod;
		p/=2;
	}
	ans%=Mod;
	return ans;
}
signed main()
{
	//;;;;;
	cin>>n>>k;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
		suma+=a[i];
		suma%=Mod;
	}
	for(int i=1;i<=n;i++)
	{
		cin>>b[i];
		sumb+=b[i];
		sumb%=Mod;
		sumc+=(a[i]*b[i])%Mod;
		sumc%=Mod;
	}
    suma+=Mod;
    sumb+=Mod;
    suma%=Mod;
    sumb%=Mod;
    sumc+=Mod;
    sumc%=Mod;
	ans=fastpower(sumc,k-1);
	ans%=Mod;
	ansa=suma*sumb%Mod;
	cout<<(ansa*ans)%Mod;
	return 0;
}

有用的信息:

  1. WA on #9

  2. 没爆ll

2022/2/9 15:33
加载中...