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
Try using long double instead of double to pass all the testcases
why doesn't using double work? are the values being provided have decimal places more than 15?
Was not working with double so I tried with string and BAAM ,....got accepted
Remember that the input is a rational number which means [spoiler]Last edit: 2019-05-02 09:47:37
Why can't we think like [spoiler] will be the answer??Last edit: 2019-01-05 12:27:32
do it by getting input in a string...dont use double...dunno why its giving WA
Spent an hour wondering why 2.3333 won't pass :(.
dont give up on this question very easy start with the very basic of [spoiler]Last edit: 2018-08-22 16:05:04
Dont use double use string for input ;even though ur answer is correct using double.