这题题目看不懂……用谷歌翻译完,更看不懂……

对A此题不看Discuss的神语言流表示膜拜


Program P2209;
var
n,p,s,ans,i:longint;
begin
read(n,p);
ans:=0;
for i:=1 to n do
begin
read(s);
if p=2 then s:=s*s;
if p=3 then s:=s*s*s;
if s>0 then inc(ans,s);
end;
writeln(ans);
end.