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 / no. 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.
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.
For each test case, find the minimum number of matches the player should have played to achieve that average.
1 <= t <= 1000
1 <= avg <= 1000000 (maximum 4 digits after the decimal place)
Sample Input: 3 5 5.5 30.25 Sample Output: 1 2 4
can anybody explain how to solve this problem
ac in a go :) do take care that there is a line break in output:
Take input as character string, convert to integer + [spoiler] !!! AC :)Last edit: 2016-07-29 22:23:00
Last edit: 2016-05-26 17:49:35
good ques...those getting WA work on these test cases...
what will be output for 3.33
@fly_sky12 It'll be 10000
if input is 3.3333
nice problem (plz don't use double...)
Nice problem... :-)