Sphere Online Judge

SPOJ Problem Set (classical)

12448. HOW MANY GAMES

Problem code: GAMES


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.

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.

Input Constraints:

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

Example:

Sample Input:

3

5

5.5

30.25

 

Sample Output:

1

2

4


Added by:cegprakash
Date:2012-10-12
Time limit:1s
Source limit:50000B
Memory limit:256MB
Cluster: Pyramid (Intel Pentium III 733 MHz)
Languages:All

hide comments
2014-04-05 09:08:09 shinchan
getting TLE...any suggestions to correct it??
2014-03-31 08:45:17 nitesh kumar
think simple..
2014-02-17 17:09:32 MANIT KUMAR
what if average is 3.3
2014-02-15 06:59:45 bluecoreenergy
pow() function showing unexpected behaviour>>>>don't know why????

CAN ANYBODY EXPLAIN TO ME??
2014-01-07 19:04:16 anurag garg
very good logical problem....
2013-11-05 12:54:36 Kalki Avatar
My 100th :-)
2013-11-03 08:32:46 AbK
My 100th :-)
2013-08-29 07:38:04 shannider
TLE!! any suggestion?
2013-08-28 02:53:09 Lakshya
oh, never trust compilers- codeblocks,dev c, code in ideone.
the same code is showing different answers in different compilers.
Finally AC !!!
2013-08-13 13:08:45 stryker
Finally AC....

Last edit: 2013-08-13 16:06:40
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.