讨论 / 思路思路————我要思路
逆骨邪龙 2011-12-06 22:37:00
点我顶贴 收藏 删除
急求思路

急急急急急急急急急!!!!!!!

#1 叶音竹@2011-12-04 20:49:00
回复 删除
爷死

var

xu,x,y,p,q,s:longint;

function gys(a,b:longint):longint;

begin

if a mod b=0 then gys:=b

else gys:=gys(b,a mod b);

end;

function gbs(a,b:longint):longint;

begin

gbs:=(a*b)div gys(a,b);

end;

begin

readln(x,y);

if x>y then xu:=x else xu:=y;

for p:=2 to xu do

for q:=2 to xu do

if (gys(p,q)=x)and(gbs(p,q)=y)then inc(s);

writeln(s);

end.

#2 叶音竹@2011-12-04 20:49:00
回复 删除
爷死

var

xu,x,y,p,q,s:longint;

function gys(a,b:longint):longint;

begin

if a mod b=0 then gys:=b

else gys:=gys(b,a mod b);

end;

function gbs(a,b:longint):longint;

begin

gbs:=(a*b)div gys(a,b);

end;

begin

readln(x,y);

if x>y then xu:=x else xu:=y;

for p:=2 to xu do

for q:=2 to xu do

if (gys(p,q)=x)and(gbs(p,q)=y)then inc(s);

writeln(s);

end.

#3 逆骨邪龙@2011-12-06 20:24:00
回复 删除
回复 沙发叶音竹 的帖子

思路!!!!!!!

#4 ?号疯子(第四代)@2011-12-06 22:37:00
回复 删除
var

n,m,l,i,x,y:longint;

function try(x1,y1:longint):boolean;

var

i,p,k:longint;

begin

try:=false;

if x1>y1 then p:=y1 else p:=x1;

k:=0;

for i:=1 to p do

if (x1 mod i=0)and(y1 mod i=0) then if i>k then k:=i;

if k=n then try:=true;

end;//在判断是否与n相等……

begin

readln(n,m);

l:=0;

for i:=n to n*m do

begin

if n*m mod i=0 then

begin

x:=i;

y:=n*m div i;

if try(x,y) then l:=l+1;

end;

end;//在枚举

write(l);

end.

查看更多回复
提交回复