GAMES - How Many Games?

no tags 

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

hide comments
vara_951: 2023-02-06 11:26:36

<snip>
Can someone pls tell why its giving Wrong answer
[Simes]: Read the footer - Don't post source code here, use the forum.

Last edit: 2023-02-06 12:15:15
the_vr7: 2020-12-05 06:15:21

I solved this question by using Linear Search but is there any other method or trick to solve this question and reduce the time complexity

[NG]: Observe the results of your solution for various inputs.

Last edit: 2020-12-05 06:56:25
gokulan_cv: 2020-07-06 08:47:09

Ignore People Who are saying AC in 1st go 2nd Go. Comment section is to provide hint for those trying to solve not to show off. Grow Up!!!!

gokulan_cv: 2020-07-06 08:46:20

HINT: Convert To Round Numbers W/o Decimals. Think, what will you do to convert. Math operators then Think Similar Approach!

sinu93065: 2020-06-01 09:50:32

can anyone give me a solution by using Double instead of using string...

fighter_4: 2020-04-09 13:58:39

guys, I do not why but take input as a string, it works, whereas a double will not!!

fighter_4: 2020-04-09 13:00:34

@aspro life saviour bro!!!

rising_stark: 2019-12-16 15:10:28

There is no thought of recurring. The answer to 0.3333 will be 10000 not 3 (using 4/3 as solution)

Last edit: 2019-12-16 15:55:52
cjchirag7: 2019-12-13 14:28:58

Try using long double instead of double to pass all the testcases

kishorerabha: 2019-10-31 15:16:40

why doesn't using double work? are the values being provided have decimal places more than 15?


Added by:cegprakash
Date:2012-10-12
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64