Good day. My semester of c++ is coming to an end. I've got to complete a total of 7 assignments within the next 3 weeks. I've completed 5 out of the seven. I've got two left (1 has a separate thread by itself). So you can also take a look at it. This is the assignment:
STOLEN GOLD SHIPMENT MYSTERY
Three gangsters rob a shipment of gold bars late one night. They
escaped to their hideout and resolved to divide the loot in the
morning.
However, as soon as one of the bandits heard the others snoring, he
divided the gold into three equal piles, finding one bar left over. He
buried one of the three piles near a tree along with the extra bar.
Then he went to sleep, sure that he had protected his interest in the
treasure.
Naturally, the other two outlaws were no more honest than the first.
Each in turn crept to the pile of gold bars, divided it three ways and
found one bar left over, which he kept along with "his" third of the
treasure.
Soon, morning came and the final three—way division. Oddly enough,
this division also left one odd bar remaining. The bandits fought over
this bar, and in an unprecedented three—way draw, shot each other
dead.
The problem is this:
Each of the four 3-way divisions left exactly one bar. How many bars
could have been in the original shipment. Assume that the shipment
contained no more than 500 bars.
No arrays/functions are necessary. So if someone could give me a jumpstart or how you'd go about addressing it, that would be appreciated. Thank you and have a good day.