Submit | All submissions | Best solutions | Back to list |
GAMES - How Many Games? |
A player has played unknown number of games. We know the average score of the player (sum of scores in all the games / number of games). Find the minimum number of games the player should have played to achieve that average.
The player can score any non-negative integer score in a game.
Input
The first line consists of an integer t, the number of test cases. Each test case consists of a single rational number which represents the average score of the player.
Output
For each test case, find the minimum number of matches the player should have played to achieve that average.
Constraints
1 <= t <= 1000
1 <= average <= 1000000 (maximum 4 digits after the decimal place)
Example
Input: 3 5 5.5 30.25 Output: 1 2 4
Added by: | cegprakash |
Date: | 2012-10-12 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 |
hide comments
|
||||||||||||||
2013-04-12 06:47:49 D Pratap
Be careful a bit while using doulbe / float for this problem . java's Double.parseDouble("0.2348") read it as 0.23479... |
||||||||||||||
2013-04-12 06:43:57 D Pratap
@ George Skhirtladze i got AC, it is expecting 10000 for 0.3333 . so the average given is not truncated average , it can be assumed as exact average. Last edit: 2013-04-12 06:45:34 |
||||||||||||||
2013-03-28 16:39:07 P[_]/|/K
nice one!!! |
||||||||||||||
2013-03-26 17:27:52 Chandan Singh
nice problem :) |
||||||||||||||
2013-03-08 12:47:32 gskhirtladze
for 0.3 answer=10 but 0.3333 answer is 3 am i right ? |
||||||||||||||
2012-12-25 12:48:30 Goldie
nice one .. a bit logical. |
||||||||||||||
2012-12-22 08:01:51 god_father
nice question...:) |
||||||||||||||
2012-11-30 11:11:04 saket diwakar
nice one...:) |
||||||||||||||
2012-11-26 22:52:45 malioboro
I'm use double and still WA, is it the same problem like user who use float? |
||||||||||||||
2012-11-13 10:51:15 Shubham Somani
nice one...be careful with float,int conversions |