var a:array[1..10000] of longint;b,c,j,k,x,y,i:longint;
begin
while not eof do
begin
readln(x);
k:=0;
for i:=2 to x do a[i]:=1;
for i:=2 to x do
for j:=2 to trunc(sqrt(i)) do
begin
if i mod j=0 then a[i]:=0;
end;
for i:=2 to x do
begin
if a[i]=1 then
begin
write(i:10);
k:=k+1;
end;
if k=5 then
begin
writeln;
k:=0;
end;
end;
end;
writeln;
readln;
end.
WA (line:8)
答案不正确
您的答案為: 73 79 83 89 ...略 正確答案為: 73 79 83 89
var a:array[1..10000] of longint;b,c,j,k,x,y,i:longint;
begin
while not eof do
begin
readln(x);
k:=0;
for i:=2 to x do a[i]:=1;
for i:=2 to x do
for j:=2 to trunc(sqrt(i)) do
begin
if i mod j=0 then a[i]:=0;
end;
for i:=2 to x do
begin
if a[i]=1 then
begin
write(i:10);
k:=k+1;
end;
if k=5 then
begin
writeln;
k:=0;
end;
end;
end;
writeln;
readln;
end.
WA (line:8)
答案不正确
您的答案為: 73 79 83 89 ...略 正確答案為: 73 79 83 89
line 8
x=90 時
write(i:10); 會多印出10個空白
第42個題目為1000,
write(i:10); 會多印出30個空白
var a:array[1..10000] of longint;b,c,j,k,x,y,i:longint;
begin
while not eof do
begin
readln(x);
k:=0;
for i:=2 to x do a[i]:=1;
for i:=2 to x do
for j:=2 to trunc(sqrt(i)) do
begin
if i mod j=0 then a[i]:=0;
end;
for i:=2 to x do
begin
if k=5 then begin writeln; k:=0; end;if a[i]=1 then
begin
write(i:10);
k:=k+1;
end;
end;
end;
writeln;
readln;
end.
WA (line:8)
答案不正确
您的答案為: 73 79 83 89 ...略 正確答案為: 73 79 83