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
hide comments
D Pratap :
2013-04-12 06:47:49
Be careful a bit while using doulbe / float for this problem . java's Double.parseDouble("0.2348") read it as 0.23479... |
|
D Pratap :
2013-04-12 06:43:57
@ George Skhirtladze
|
|
P[_]/|/K:
2013-03-28 16:39:07
nice one!!! |
|
Chandan Singh:
2013-03-26 17:27:52
nice problem :)
|
|
gskhirtladze:
2013-03-08 12:47:32
for 0.3 answer=10
|
|
Goldie:
2012-12-25 12:48:30
nice one .. a bit logical. |
|
god_father:
2012-12-22 08:01:51
nice question...:) |
|
saket diwakar:
2012-11-30 11:11:04
nice one...:) |
|
malioboro:
2012-11-26 22:52:45
I'm use double and still WA, is it the same problem like user who use float? |
|
Shubham Somani:
2012-11-13 10:51:15
nice one...be careful with float,int conversions |
Added by: | cegprakash |
Date: | 2012-10-12 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 |