|
|
вернуться в форумWA Послано Snetch 22 июл 2008 06:55 I tried all tests that I found on the discussion board, and several random tests. On all of them this prog works fine. But I am still getting WA1 when I send it in. var p1,q1:Real; p,q,p2,q2,x,ans:LongInt; begin Readln(p1); p:=round(p1*100); Readln(q1); q:=round(q1*100); ans:=0; repeat ans:=ans+1; p2:=ans*p; q2:=ans*q; x:=p2+10000-p2 mod 10000; until x<q2; Writeln(ans); end. If I change it like this (I suppose, if the precision is three digits, it would work), I get TLE1. var p1,q1:Extended; p,q,p2,q2,x,ans:QWord; begin Readln(p1); p:=round(p1*1000); Readln(q1); q:=round(q1*1000); ans:=0; repeat ans:=ans+1; p2:=ans*p; q2:=ans*q; x:=p2+1000000-p2 mod 1000000; until x<q2; Writeln(ans); end. I never got through the first test =( Darhan_Akzholov: WA var p1,q1:Real; p,q,p2,q2,x,ans:LongInt; begin Readln(p1); Readln(q1); - This is your MISTAKE !!!! q:=round(q1*100); p:=round(p1*100); ans:=0; repeat ans:=ans+1; p2:=ans*p; q2:=ans*q; x:=p2+10000-p2 mod 10000; until x<q2; Writeln(ans); end. You mast change { Readln(p1); Readln(q1); } to { read(p1,q1) } !!!!!!!!!!!!
Edited by author 18.08.2008 16:04 Re: Darhan_Akzholov: WA Послано Snetch 24 авг 2008 22:47 Thank you, I got AC! Damn it, I wasted so much time on this problem! |
|
|