Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

为什么WA?

Posted by paddy at 2010-07-05 11:11:49 on Problem 2429
var
  a,b,lcm,gcd,t,s,i:int64;

function pp(x,y:int64):boolean;
var
  temp:int64;
begin
  while x mod y<>0 do begin
    temp:=x mod y;
    x:=y;
    y:=temp;
  end;
  if y=1 then pp:=true else pp:=false;
end;  

begin
  readln(gcd,lcm);
  t:=lcm div gcd;
  i:=trunc(sqrt(t));
  while i>=1 do begin
    if (t mod i=0) and pp(t div i,i) then begin
      a:=i*gcd; b:=(t div i)*gcd;
      writeln(a,' ',b);
      halt;
    end;
    dec(i);
  end;
end. 

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator