题目: |
program exp1;
var i,j,k:integer; a:array[0..100]of integer;
begin
for i:=0 to 100 do a[i]:=i;
for k:=5 downto 2 do
begin
for i:=1 to 100 do if ( i mod k)=0 then a[i]:=0;
for i:=1 to 99 do
for j:=1 to 100-i do
if a[j]>a[j+1]then begin
a[j]:=a[j]+a[j+1];
a[j+1]:=a[j]-a[j+1];
a[j]:=a[j]-a[j+1];
end;
end;
j:=1;
while (a[j]=0)and (j<100) do j:=j+1;
for i:=j to 100 do a[0]:=a[0]+a[i]; writeln(a[0]);
end. 输出:970
|