Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
Re:输入1(或-1)是多少?In Reply To:Re:输入1(或-1)是多少? Posted by:realmajia at 2005-01-30 20:32:44 Why WA? my code: var n,k,s:longint; p,i:integer; f,y:boolean; begin readln(n); while n<>0 do begin f:=false; p:=33; if n<0 then begin n:=-n; f:=true; end; y:=false; repeat dec(p); k:=round(exp((1/p)*ln(n))); s:=1; for i:=1 to p do s:=s*(k-1); if s=n then y:=true; s:=1; for i:=1 to p do s:=s*k; if s=n then y:=true; s:=1; for i:=1 to p do s:=s*(k+1); if s=n then y:=true; until ((y)and(not f))or((y)and(f)and(p mod 2=1))or(p=1); writeln(p); readln(n); end; end. I think it's right! Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator