我还没作到那里(主要是因为NOIP没做了)这是别人的程序: program ariprog; const maxbisqr=125000; var fin,fout:text; bisqr:array[0..maxbisqr]of boolean; n,m:byte; a,b:longint; flag:boolean; procedure check; var i:integer; begin for i:=n-1 downto 0 do if not bisqr[a+b*i] then exit; writeln(fout,a,' ',b); flag:=true; end; begin assign(fin,'ariprog.in'); reset(fin); readln(fin,n); readln(fin,m); close(fin); fillchar(bisqr,sizeof(bisqr),0); for a:=0 to m do for b:=a to m do bisqr[a*a+b*b]:=true; assign(fout,'ariprog.out'); rewrite(fout); flag:=false; for b:=1 to m*m*2 div (n-1) do for a:=0 to m*m*2-(n-1)*b do check; if not flag then writeln(fout,'NONE'); close(fout); end.
|