这题题目看不懂……用谷歌翻译完,更看不懂……
对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.
本文分享了一段针对P2209问题的程序代码,该程序读取一系列整数并根据输入参数p(2或3)计算每个整数的平方或立方,如果p为其他值则直接使用原数,并在整数大于0时累加求和。
794

被折叠的 条评论
为什么被折叠?



