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-10-08 21:55:42 Devesh Aggrawal
Boundary conditions...getting 1st TLE and then wrong answer.... |
||||||||||||||
2015-09-25 13:09:21 Kriti Singhal
why the hell is it giving WA using double???? |
||||||||||||||
2015-09-07 22:03:32
Is the Solution is possible without String ? |
||||||||||||||
2015-08-12 22:15:41 Dhruv Mullick
@xpshekhar, 10000. |
||||||||||||||
2015-08-05 14:30:37
what if the user input is 3.3333. 3 or 10000? Last edit: 2015-08-05 14:31:25 |
||||||||||||||
2015-07-24 02:23:03
Why is this giving a wrong answer? I have checked all the testcases I could come across, and it seems to be working fine. http://ideone.com/J7YNqC |
||||||||||||||
2015-07-11 21:15:50 ASHUTOSH DWIVEDI
WA using input as double Why???? and using string AC..what the f*** Last edit: 2015-07-11 21:58:09 |
||||||||||||||
2015-07-07 20:00:11
ac in 2 nd go .just [spoiler removed] Last edit: 2015-08-10 20:56:10 |
||||||||||||||
2015-06-23 17:49:40 Sandeep N Menon
python giving TLE |
||||||||||||||
2015-06-13 16:19:21 Bhuvnesh Jain
to avoid floating point errors use int and char... AC in one go. |