ENG  RUS Timus Online Judge
Online Judge
Problems
Authors
Online contests
Site news
Webboard
Problem set
Submit solution
Judge status
Guide
Register
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

## Discussion of Problem 1300. Taxes

Problem 1300 is UNFAIR!
Posted by Walrus 24 Aug 2006 22:16
In this problem we need to calculate R(S): F(R) = S,
where F(R) = R – T(R) + L%*R – T(L%*R).
But function F(R) is NOT increase monotonically!
In other words, it is possible to find R: F(R) = F(R+1).
So, it is impossible to calculate unique R(S).

Example:
99
1000000000 10
2000000000 40
3000000000 41
0          77
100000000
2000000000
3000000000
4200000000
5000000000
1100000001
2200000000
3300000001
-1

If in your program R(S) = max{R: F(R) = S}
(and you'll get AC)

If in your program R(S) = min{R: F(R) = S}
(and you'll get WA #7)

Which of they are correct? And why?
Re: Problem 1300 is UNFAIR!
Posted by Chmel_Tolstiy 15 Jul 2008 03:15
Admins. I think Walrus is right. may be need to change a statement...
Re: Problem 1300 is UNFAIR!
Posted by svr 24 Nov 2008 21:07
It is mathematical situation and not of statement.
max{R: F(R) = S} may be =1/3 and approxed by double with eps. After rounding this eps may convert 0.4999999999~0.0
in 0.5000000000001~1. Thus we must solve the problem above
fractions __int64/_int64.

Got Ac when R is double but after floor(R*100+0.5)/100
This problem is another example that in double
calculations we need in description of the author algorithm.

Edited by author 26.08.2009 12:56
Re: Problem 1300 is UNFAIR!
Posted by Fly [Yaroslavl_SU] 6 Dec 2008 20:47
There is no fractions. I just used int64. :)
Re: Problem 1300 is UNFAIR!
Posted by svr 8 Dec 2008 12:36
Suggestion to find R(S) = max{R: F(R) = S}
must be added with information: In what class of numbers
should we seach of the S?
1) Numbers of pattern ########.## - rubles and copeys
2) All real numbers