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
|
||||||||||||||
2015-06-12 17:27:39 :.Mohib.:
Nice que!! |
||||||||||||||
2015-06-05 12:26:22
Solved it using strings. Can anyone please tell me the cases where floats give errors? |
||||||||||||||
2015-05-15 09:53:28 aloo
why is using double giving WA?? |
||||||||||||||
2015-05-12 19:57:57 Siddharth Shah
can anyone give me few boundary cases. Giving me WA but all answers for boundary cases mentioned in comments are matching :( |
||||||||||||||
2015-02-28 06:05:35 Ankit Sultana
Can be done without strings per se |
||||||||||||||
2015-01-27 23:08:56 Saksham
beware of floating pt errors costed me 1WA |
||||||||||||||
2015-01-14 21:37:18 deathgun
good question and must for beginners :) |
||||||||||||||
2015-01-07 19:21:23 rahul goyal
very gud questn (y) |
||||||||||||||
2014-12-24 17:50:44 Anand
u have python , u have power !!! |
||||||||||||||
2014-12-18 13:49:41 Kushal Singh
well ...just so that you know ...using double might not be a good idea :P |