此题描述很长但很水,zzj讲得很详细
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
int n,m,ans=0;
int main()
{
int i,tmp;
#ifndef ONLINE_JUDGE
freopen("sgu163.in","r",stdin);
freopen("sgu163.out","w",stdout);
#endif
scanf("%d%d",&n,&m);
for(i=1;i<=n;i++)
{
scanf("%d",&tmp);
tmp=pow(tmp,m);
if(tmp>0)
{
ans+=tmp;
}
}
printf("%d",ans);
#ifndef ONLINE_JUDGE
fclose(stdin);
fclose(stdout);
#endif
return 0;
}