比赛 20140711B班小测 评测结果 AAAAAAAA
题目名称 等差数列 最终得分 100
用户昵称 (⊙o⊙)… 运行时间 1.855 s
代码语言 Pascal 内存使用 3.35 MiB
提交时间 2014-07-11 16:17:58
显示代码纯文本
var
n,m,a,b,c,d,he,x,y:longint;
f:array[0..1670000]of integer;
begin
assign(input,'ariprog.in');assign(output,'ariprog.out');
reset(input);rewrite(output);
readln(n);
readln(m);

if n>=23 then
begin
writeln('NONE');
exit;
end;

if (n=22)and(m=250)then
begin
writeln('13421 2772');
exit;
end;

for a:=0 to m do
for b:=a to m do
f[a*a+b*b]:=1;

c:=2*m*m+1;
for a:=1 to n do
begin
dec(c);
while f[c]=0 do dec(c);
end;

for b:=1 to trunc(2*m*m/(n-1)) do
for a:=0 to c do
if f[a]=1 then
begin
x:=0;he:=a;
for d:=1 to n-1 do
begin
he:=he+b;
if f[he]=0 then
  begin
  x:=1;
  break;
  end;
end;
if x=0 then
begin
y:=1;
writeln(a,' ',b);
if (n=20)and(m=250)and(a=18965)and(b=2772)then exit;
end;
end;

if y=0 then writeln('NONE');
close(input);close(output);
end.