#include<iostream>
#include<cmath>
using namespace std;
int main()
{
int num, b, i, s, ans, tmp;
while (cin >> num >> b){
ans = 0;
for (i = 0; i < num; i++){
cin >> s;
tmp = pow(s, (float)b);
ans += (tmp > 0 ? tmp : 0);//这个地方需要注意,如果是大于0的就加,要不就当0相加!
}
cout << ans << endl;
}
system("pause");
}
poj 2209 The King
最新推荐文章于 2017-03-20 17:49:00 发布