| 比赛 |
五一大礼包 |
评测结果 |
AAEEEEEEEE |
| 题目名称 |
组一辈子乐队 |
最终得分 |
20 |
| 用户昵称 |
ChenBp |
运行时间 |
1.328 s |
| 代码语言 |
C++ |
内存使用 |
3.42 MiB |
| 提交时间 |
2026-05-04 11:14:15 |
显示代码纯文本
#include<iostream>
#include<cstdio>
using namespace std;
typedef long long ll;
const ll mod=998244353;
int a[502];
ll ksm(ll x,ll y){
ll res=1;
while(y){
if(y&1) res=res*x%mod;
x=x*x%mod;
y>>=1;
}
return res;
}
int main(){
freopen("MyGo.in","r",stdin);
freopen("MyGo.out","w",stdout);
int n,k;
cin>>n>>k;
for(int i=1;i<=n;i++){
cin>>a[i];
}
for(int x=1;x<=k;x++){
ll ans=0;
for(int i=1;i<=n;i++){
for(int j=i+1;j<=n;j++) {
ans+=ksm(a[i]+a[j],x);
ans%=mod;
}
}
cout<<ans<<endl;
}
return 0;
}