ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1011. Conductors

WA 3 or 6
Posted by voral 15 Jun 2011 14:58
Now I have:
Input: 10 10 Answer: 10
Input: 13 14.1 Answer: 15

but:
float p, q;
scanf ("%f %f", &p, &q);
p/=100;
q/=100;

result: WA6

but:
float p, q;
scanf ("%f %f", &p, &q);
p=(float)((int)(p*100))/10000.00;
q=(float)((int)(q*100))/10000.00;
//Only 2 digits after dot

result: WA3

Why?

PS (ceil(p*cnt)-((int)(q*cnt)))>1e-7
Re: WA 3 or 6
Posted by ilya_romanenko 15 Jun 2011 15:17
Use double,don't float