比赛 五一大礼包 评测结果 WWTTTTTTTT
题目名称 组一辈子乐队 最终得分 0
用户昵称 梦那边的美好ME 运行时间 9.014 s
代码语言 C++ 内存使用 4.65 MiB
提交时间 2026-05-04 10:01:39
显示代码纯文本
#include <bits/stdc++.h>
using namespace std;
#define ll long long

const ll mod=998244353;

ll n,k;
ll a[210000];
ll ans;

ll mpow(ll aa,ll bb){
	ll res=1;
	while (bb){
		if (bb&1) res=(res*aa)%mod;
		aa=(aa*aa)%mod;
		bb>>=1;
	}
	return res;
}

int main(){
	freopen("MyGo.in","r",stdin);
	freopen("MyGo.out","w",stdout);
	ios::sync_with_stdio(0);
	cin.tie(0);cout.tie(0);
	cin>>n>>k;
	for (int i=1;i<=n;i++){
		cin>>a[i];
	}
	for (int kk=1;kk<=k;kk++){
		ans=0;
		for (int i=1;i<n;i++){
			for (int j=i+1;j<=n;j++){
				ans+=mpow(a[i]+a[j],kk);
			}
		}
		cout<<ans<<'\n';
	}
	
	return 0;
}