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
|
||||||||||||||
2014-09-18 13:30:03 Shivam kumar
if avg = 3.3333 then no. of matches = 10 is correct or not |
||||||||||||||
2014-08-03 18:37:29 Bodh Almast
any tricky test case? i tried 999999.9999 -> 1000 |
||||||||||||||
2014-07-13 06:14:40 kiran pilli
learnt a new thing..nice problem |
||||||||||||||
2014-07-12 23:12:51 ήάέέϻ Ÿ
nice and easy :) good question :) |
||||||||||||||
2014-07-07 18:36:17 pandu ranga rao
Constraints helped me... nice one |
||||||||||||||
2014-07-02 09:35:53 Mayank
learned a lot about conversions but AC using strings ,nice problem. |
||||||||||||||
2014-06-26 03:46:44 Soma
learnt something new../ |
||||||||||||||
2014-06-20 16:48:18 Ravi Shankar Mondal
piece of cake using string Last edit: 2014-06-20 16:50:45 |
||||||||||||||
2014-06-19 14:11:11 L
not able to solve first time !! but solve after a month .... :) |
||||||||||||||
2014-04-05 09:08:09 shinchan
getting TLE...any suggestions to correct it?? |