9
4
2013
1

【BZOJ1041】【HAOI2008】圆上的整点【数学题】

瞎搞搞,用勾股定理的通式

program p1041;
	var
		len,tot,r,i,j:longint;
		x:array[1..10000,1..2] of longint;
	function find(k:longint):longint;
		var	
			i,j,a,b,num,c,d:longint;
			bo:boolean;
		begin
			num:=0;
			for i:=2 to trunc(sqrt(k)) do
				if sqr(trunc(sqrt(k-i*i)))=k-i*i then begin
					a:=trunc(sqrt(k-i*i));
					b:=i;
					if (a<=b) or (a=0) or (b=0) then continue;
					c:=2*a*b; d:=a*a-b*b;
					a:=c; b:=d;
					if a>b then begin j:=a; a:=b; b:=j; end;
					bo:=false;
					for j:=1 to len do begin
						if a/x[j,1]=b/x[j,2] then begin
							bo:=true; break;
						end;
					end;
					if bo=false then begin
						num:=num+2;
						inc(len);
						x[len,1]:=a; x[len,2]:=b;
					end;
				end;
			exit(num);
		end;
	begin
		readln(r);
		tot:=1; len:=0;
		for i:=1 to trunc(sqrt(r)) do
			if r mod i=0 then begin
				if i<>r div i then
					tot:=tot+find(i)+find(r div i)
				else 
					tot:=tot+find(i);
			end;
		tot:=tot*4;
		writeln(tot);
	end.
Category: 数学题 | Tags: | Read Count: 2359
Avatar_small
GSEB HSC Question Pa 说:
2022年8月17日 02:31

The sample exam papers for people pursuing their intermediate or 12th grade exams will soon be made public by the Gujarat Board of Higher Secondary Education. The sample test will shortly be linked below. GSEB HSC Question Paper 2023 The dates for the tests will be announced separately in February 2023 on the Gujarat Board's official website and following the release of the Gujarat HSC 12th Question Paper 2023. According to this, the Gujarat Board will be holding its whole HSC 12th Class examination in the near future. All of these students are browsing online for the model question papers for this board's current test.


登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter

Host by is-Programmer.com | Power by Chito 1.3.3 beta | Theme: Aeros 2.0 by TheBuckmaker.com