no tags 

Problem Statement:

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.

Input Constraints:

1 <= t <= 1000
1 <= avg <= 1000000 (maximum 4 digits after the decimal place)


Sample Input:

Sample Output:

hide comments
prasoonbatham: 2016-10-19 16:32:38

Take input as a string. Remember how floating points are stored. :)

coder_hsnake: 2016-10-14 00:24:07

finally happy to remove it from my todo list after a long time though lots of WAs for this ques :-))

aaliya_1: 2016-09-25 07:54:04

Can someone plz explain what may be the possible reason to get WA.I am getting correct answer for every test cases even in ideone but here it is still showing WA.

Last edit: 2016-09-25 08:09:23
surayans tiwari( 2016-09-05 20:51:22

take input as string rest is fine

avi054: 2016-08-20 21:28:44

can anybody explain how to solve this problem

vineetpratik: 2016-06-26 20:03:00

ac in a go :) do take care that there is a line break in output:
Hint- [spoiler]

Last edit: 2016-07-29 22:22:39
anuj0503: 2016-06-12 18:43:00

Take input as character string, convert to integer + [spoiler] !!! AC :)

Last edit: 2016-07-29 22:23:00
the_darkknight: 2016-05-26 17:10:57

Last edit: 2016-05-26 17:49:35
aspro: 2016-05-26 07:36:55

good ques...those getting WA work on these test cases...
5.65->20 , 5.6->5 , 5.8->5 , 5.33->100 , 5.35->20 , 5.3030->1000

kanishkajoshi: 2016-03-28 22:19:52

what will be output for 3.33

Added by:cegprakash
Time limit:0.185s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)