作业帮 > 综合 > 作业

有关pascal的几道题

来源:学生作业帮 编辑:作业帮 分类:综合作业 时间:2024/05/07 06:20:27
有关pascal的几道题
http://10.12.10.10:9015/JudgeOnline/showproblem?problem_id=1225
http://10.12.10.10:9015/JudgeOnline/showproblem?problem_id=1116
http://10.12.10.10:9015/JudgeOnline/showproblem?problem_id=1058
抱歉,发成校内网了
网址是
http://218.5.5.242:9015/JudgeOnline/showproblem?problem_id=1116
http://218.5.5.242:9015/JudgeOnline/showproblem?problem_id=1058
1、
var
i,sum,n:longint;
begin
readln(n);
sum:=1;
for i:=1 to n do
sum:=sum*i;
writeln(sum);
end.
2、
var
f:array[1..10000] of boolean;
i,n,sum:longint;
begin
readln(n);
fillchar(f,sizeof(f),true);
for i:=2 to trunc(sqrt(n)) do
for j:=2 to n div i do
f[i*j]:=false;
sum:=0;
for i:=1 to n do
if f[i] then inc(sum,f[i]);
writeln(sum);
end.
时间匆忙,没有编译,自己看看吧