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
|
deathgun:
2015-01-14 21:37:18
good question and must for beginners :) |
|
rahul goyal:
2015-01-07 19:21:23
very gud questn (y) |
|
Anand:
2014-12-24 17:50:44
u have python , u have power !!! |
|
Kushal Singh:
2014-12-18 13:49:41
well ...just so that you know ...using double might not be a good idea :P |
|
Shivam kumar :
2014-09-18 13:30:03
if avg = 3.3333
|
|
Bodh Almast:
2014-08-03 18:37:29
any tricky test case?
|
|
kiran pilli:
2014-07-13 06:14:40
learnt a new thing..nice problem
|
|
ήάέέϻ Ÿ:
2014-07-12 23:12:51
nice and easy :) good question :) |
|
pandu ranga rao:
2014-07-07 18:36:17
Constraints helped me... nice one
|
|
Mayank:
2014-07-02 09:35:53
learned a lot about conversions but AC using strings ,nice problem. |
Added by: | cegprakash |
Date: | 2012-10-12 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 |