|
|
вернуться в форумAny mistake about precision? program ural1283; const zero=1e-6; var a,b:longint; c:real; begin read(a,b,c); writeln(trunc(ln(b/a)/ln(1-c/100)+1+zero)); end. If formula fails just try simulation :) (-) But still WA #1! My old formula was wrong, and a new one is here in the prog below. When I submit, I comment out either part. But neither simulation nor formula works, they both get WA #1. BTW, what is the output for 2 1 50? Is it 1 or 2? program ural1283; var b,ans:longint; a,c:real; begin read(a,b,c); c:=1-c/100; //Simulation: while a>=b do begin inc(ans); a:=a*c; end; writeln(ans); //Formula: ans:=trunc(ln(b/a)/ln(c)+1); if ans<0 then writeln(0) else writeln(ans); end. |
|
|