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 1443. Rails

What's wrong with my formula?!
Posted by Alexey 25 Jun 2006 13:59
  Readln(n);
  Readln(ss); delete(ss,pos('.',ss),1); Val(ss,s,r);
  Readln(ss); delete(ss,pos('.',ss),1); Val(ss,l,r);
  count:=(s div l)*n+((s mod l)*n) div l+1;

Please...
Re: What's wrong with my formula?!
Posted by Sid 25 Jun 2006 18:06
Precision is main trouble of this problem =)
OK, but I don't Use real types... Can U give me the test to improve my program?
Posted by Alexey 25 Jun 2006 18:26
Re: OK, but I don't Use real types... Can U give me the test to improve my program?
Posted by Sid 25 Jun 2006 22:20
I will try to explain...
When you read real number, for example 1.115, after reading you can get something like 1.11499999, and after custing to integer you'll get 1114 instead 1115. Just try different tests.
But I read String!
Posted by Alexey 26 Jun 2006 11:34
Re: But I read String!
Posted by Sid 26 Jun 2006 11:47
Just give me your e-mail and I'll send you c++ source.
Re: But I read String!
Posted by Alexey 26 Jun 2006 14:31
I don't need your code!
I want to understand mistake in my formula!

Well. OK, Ok... you've talked me in :)
_magistr.90@mail.ru