liruyuan 2010-08-12 03:49:00
点我顶贴
收藏
删除
请各位大牛帮忙看看
测试结果1: 通过本测试点|有效耗时172ms
测试结果2: 通过本测试点|有效耗时47ms
测试结果3: 通过本测试点|有效耗时47ms
测试结果4: 输出过长|用户输出数据超过标准输出两倍[标准输出1位|选手输出4位]
测试结果5: 通过本测试点|有效耗时46ms
我的代码
program Project1;
var
x0,y0,p,q,r,s,t,k:int64;
p1,q1:longint;
function hz(a,b:longint):boolean;
VAR
c,m,n,i:longint;
BEGIN
m:=a;
n:=b;
hz:=true;
IF m>n then
BEGIN
c:=m; m:=n; n:=c;
END;
FOR i:=2 to m do
BEGIN
IF (((m mod i)=0) and ((n mod i)=0)) then
BEGIN
hz:=false; break;
END;
END;
END;
begin
read(x0,y0); s:=0;
if (y0 mod x0<>0) then writeln('0');
if y0=x0 then writeln('1');
if x0>y0 then begin k:=x0; x0:=y0; y0:=k; end;
if (y0 mod x0=0)and(x0<>y0) then
begin
r:=trunc(y0/x0);
for p1:=1to r do
for q1:=1to r do
if (p1*q1=y0/x0)and(hz(p1,q1)=true) then inc(s);
end;
writeln(s);
readln(t);
end.