|
|
вернуться в форумAdvices 1) Use SINGLE type in Pascal or correct real compare: function eq(a, b: float): boolean; begin Result := abs(a-b) <= eps; //eps is calculations accuracy end; 2) Don't forget that frac(p*x) and frac(q*x) may be 0. Re: Advices Послано Hramov 3 дек 2005 19:28 i don't understand, why my program do not pass test with real-type and pass with single. i do not use constructions such as real=real. my code: {$APPTYPE CONSOLE} uses sysutils; var a,b:single; n:longint; begin n:=0; readln(a,b); while true do begin inc(n); if (trunc(n*a/100)+1<n*b/100)and(trunc(n*b/100)>n*a/100)then begin writeln(n);exit; end; end; end. anybody know test N3?? |
|
|