主题:加分!看看偶这个为什么错?
看看偶这个为什么错?
var
p,n,i,j,k,l,m,r:longint;
a:array[1..2] of longint;
begin
while not seekeof (input) do
begin
readln(n);
a[1]:=0;
a[2]:=0;
r:=1;
p:=0;
k:=0;
i:=2;
l:=n;
for i:=2 to round(sqrt(n)) do
begin
if n mod i =0
then begin
p:=p+1;
j:=i;
n := n div i;
i:=i-1 ;
a[r]:=i+1;
r:=r+1;
end;
if p=3
then break;
end;
if p=1
then begin
k:=l div j;
for i:=2 to round(sqrt(j)) do
if k mod i =0
then m:=1;
if m=0
then begin
a[r]:=k;
p:=2;
end;
end;
if (p=2)and(a[1]*a[2]=l)
then writeln('It',chr(39),'s a MaoLaoDa number.')
else writeln('It',chr(39),'s not a MaoLaoDa number.');
end;
end.
tp显示文件未用输入方式打开
而在tj的测试中显示:Main601191.code.pas(2,1) Fatal: Syntax error, identifier expected but VAR found
var
p,n,i,j,k,l,m,r:longint;
a:array[1..2] of longint;
begin
while not seekeof (input) do
begin
readln(n);
a[1]:=0;
a[2]:=0;
r:=1;
p:=0;
k:=0;
i:=2;
l:=n;
for i:=2 to round(sqrt(n)) do
begin
if n mod i =0
then begin
p:=p+1;
j:=i;
n := n div i;
i:=i-1 ;
a[r]:=i+1;
r:=r+1;
end;
if p=3
then break;
end;
if p=1
then begin
k:=l div j;
for i:=2 to round(sqrt(j)) do
if k mod i =0
then m:=1;
if m=0
then begin
a[r]:=k;
p:=2;
end;
end;
if (p=2)and(a[1]*a[2]=l)
then writeln('It',chr(39),'s a MaoLaoDa number.')
else writeln('It',chr(39),'s not a MaoLaoDa number.');
end;
end.
tp显示文件未用输入方式打开
而在tj的测试中显示:Main601191.code.pas(2,1) Fatal: Syntax error, identifier expected but VAR found