sgu163 分类: sgu 2015-02-15 17:31 60人阅读 评论(0) 收藏

此题描述很长但很水,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;
}
posted @ 2015-02-15 17:31  <Dash>  阅读(148)  评论(0编辑  收藏  举报