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
|
||||||||||||||
2013-07-11 13:20:56 L
!!! same code gives tle and ac !! weird.. |
||||||||||||||
2013-06-21 12:28:15 Himanshu
Ah! AC :) enjoy solving! nice problem |
||||||||||||||
2013-06-21 12:27:10 Himanshu
easy problem. a silly mistake cause me 1 WA and 1 TLE Last edit: 2013-06-21 12:29:20 |
||||||||||||||
2013-05-29 10:23:37 Mayank Manish
I am getting the correct answer but my time limit has exceeded. i'm using break statement in my code. any suggestion to rectify??? |
||||||||||||||
2013-05-27 21:57:59 Chandan Mittal
what will be the correct o/p for 0.3332 and 0.3334 |
||||||||||||||
2013-04-28 08:55:47 Rajarshi Sarkar
Nice one :) |
||||||||||||||
2013-04-25 09:10:18 Arika Saputro
be careful convert double to integer in c++ ;D |
||||||||||||||
2013-04-21 10:48:10 :-)
nice problem |
||||||||||||||
2013-04-19 00:13:37 Eduardo Nunes
nice one, AC without even using any float variables :-D for 10.3345 answer is 2000 ;-) |
||||||||||||||
2013-04-12 11:47:41 Ramanjaneyulu Nallagonda
what is ans for 10.3345? |