Hey everyone so I'm completely stuck on a assignment of mine. First let me say that I'm not expecting anyone to just give me a solution, just some help finding that solution.

My problem is this. I will be given a random number that will represent the average score of a player. What I am suppose to do is determine what is the minimum number of times that player had to play to get that average score. THe input has to be able to handle up to 4 digits after the decimal. I believe he got this from a programming competition question cause it sounds like one.

So basically I need to create a program so that it prompts the user to enter a number(Average) then the program will output the minimum number of times to get that average.

I'll be honest I am not the greatest with math so I am having trouble coming up with a way to solve this assignment question.

My problem is this. I will be given a random number that will represent the average score of a player. What I am suppose to do is determine what is the minimum number of times that player had to play to get that average score. THe input has to be able to handle up to 4 digits after the decimal. I believe he got this from a programming competition question cause it sounds like one.

So basically I need to create a program so that it prompts the user to enter a number(Average) then the program will output the minimum number of times to get that average.

I'll be honest I am not the greatest with math so I am having trouble coming up with a way to solve this assignment question.

Been looking on competition websites since it sounded like one and have finally found the question. It can be found here http://www.spoj.com/problems/GAMES/.

My professors made some tweaks in the assignment though.

The scores can be of unsigned integer value only

His input will be between

1 <= avg <= 1000000 with a maximum of 4 digits after decimal place.

Which is the same as the spoj question. Quite weird I wonder if professors borrow a lot of them assignment questions from competition questions lol.

My professors made some tweaks in the assignment though.

The scores can be of unsigned integer value only

His input will be between

1 <= avg <= 1000000 with a maximum of 4 digits after decimal place.

Which is the same as the spoj question. Quite weird I wonder if professors borrow a lot of them assignment questions from competition questions lol.

Looks simple enough at first glance.

A. The whole number portions of the score are completely irrelevant.

B. The decimal portions can be represented as a fraction or ratio.

If, for instance, an average score was 10.25, we represent the decimal part as 25/100, which can be reduced to 1/4. See anything interesting there?

A. The whole number portions of the score are completely irrelevant.

B. The decimal portions can be represented as a fraction or ratio.

If, for instance, an average score was 10.25, we represent the decimal part as 25/100, which can be reduced to 1/4. See anything interesting there?

Not sure If I am going in the right direction or the completely wrong direction (Sorry I am horrible with math), but that lowest number of times would be the reduced denominator of the decimal? So in the case of 10.25 it would be 4? And 15.33 would be 3?

No. .33 is represented by 33/100. 33/100 cannot be reduced further, so for 15.33 the answer is 100.

Ahh ok I understand it now I believe so then .3333 would be 10,000. Thank you again cire for your help very much appreciated.

Topic archived. No new replies allowed.