不是VIP会员,不能显示答案

题目解答

题目:
program t4;
var i,k,n :integer;
x,w :array[1..500] of integer;
begin
readln(n);
for i:= 1 to n do begin
x[i]:= 0; w[i]:= 1;
end;
for i:= 2 to trunc(sqrt(n))+1 do
if x[i]=0 then
begin
k:= i*i;
while k<=n do begin
x[k]:= i;
k:= k + i;
end;
end;
for i:= n downto 1 do
if x[i]<>0 then
begin
w[x[i]]:= w[x[i]] + w[i];
w[i div x[i]]:= w[i div x[i]] + w[i];
w[i]:= 0;
end;
writeln(w[2],w[3]:5,w[5]:5);
end.

1、输入:10
2、输入:290
输出: 8 4 2
287 142 71
考点:
分析:
解答:
评论:
老师: