Hi! I have a problem here and I don't know where to start. Please help me. Thanks
Here's the problem..
You, and two friends, have been hired by a computer firm to clean up their office of all their unused diskettes. These are hidden in various desk drawers and must be collected together into a large pile. As a reward these diskettes are to be divided up equally between you and your friends to take home. How many diskettes were there to start with if the following is true? (There is more than one answer to the puzzle.)
While everybody was out at coffee, one of your friends sneaks into the room, divides up the diskettes into three equal piles, hides one of the piles and puts the others back into the original pile. There was one diskette left over after the division (ruined by virus), which was thrown away.
At the next coffee break, the other friend came along, splits the new pile into 3 and hides his share. Again there was one left over (virus killed) which was thrown away. The others were piled back together.
At the end of the day, all the diskettes that were left in the pile were split up equally amongst you and your friends, and again there was one left over, killed by virus.
INPUT
- the judge will input a guess of how many diskettes there were in the original pile
OUTPUT
- The program must determine if that guess (or one of the next 10 numbers above it) satisfies the puzzle given above. If one of the numbers in the range satisfies the puzzle, print how many diskettes everybody gets to take home.
SAMPLE RUN
Number: 6
No valid number in the range 6 - 16
Again (y/n): Y
Number: 48
Valid starting number: 52
Friend 1: 24 Friend 2: 18 Me: 7 Virus: 3
Again (y/n): N