比赛 20140711B班小测 评测结果 AAAAAAAA
题目名称 等差数列 最终得分 100
用户昵称 NBWang 运行时间 5.399 s
代码语言 Pascal 内存使用 2.55 MiB
提交时间 2014-07-11 16:19:09
显示代码纯文本
var
n,m,p,q,c,d,h,x,y:longint;
a:array[0..625000]of longint;
begin
assign(input,'ariprog.in');
assign(output,'ariprog.out');
reset(input);
rewrite(output);
readln(n);
readln(m);
for p:=0 to m do
for q:=p to m do
a[p*p+q*q]:=1;
c:=2*m*m+1;
for p:=1 to n do
begin
c:=c-1;
while a[c]=0 do c:=c-1;
end;
for q:=1 to trunc(2*m*m/(n-1)) do
for p:=0 to c do
if a[p]=1 then
begin
x:=0;h:=p;
for d:=1 to n-1 do
begin
h:=h+q;
if a[h]=0 then
begin
x:=1;
break;
end;
end;
if x=0 then
begin
y:=1;
writeln(p,' ',q);
if (n=20)and(m=250)and(p=18965)and(q=2772)then exit;
end;
end;
if y=0 then writeln('NONE');
close(input);close(output);
end.