ZOJ Problem Set - 1772
Baby Huey's obsession for the week was circles. He would consistently go after all things round: Frisbees, plates, wheels, hubcaps, and even the occasional manhole cover. Being large and stubborn, Baby Huey had built up quite a collection in his sandbox.
Today, Baby Huey discovered his Papa's coin collection and his Mama's set of trays. Pleased at having uniform sets of disks to play with, Baby Huey started to devise different games to amuse himself.
His favorite game, by far, was to arrange a circle of coins of the same type along the inner rim of one of his Mama's trays. He would do this without filling in the space formed by the circle of coins, like so:
No one really knows why Baby Huey likes playing this game, but Mama and Papa were secretly pleased that Baby Huey had started to apply his counting skills. Baby Huey would try to guess the number of coins he could fit in the tray! Of course, they were hoping he wouldn't break their precious collections in the process.
Play along with Baby Huey in his simple game. Use your computer to predict the number of coins he can fit into each tray.
Write a program that will take in the radius t of a tray and the radius c of a coin (same units, both integers). The output of this program should be the number of coins that can line the inner rim of the tray.
The input file consists of several test cases. Each test case consists of two lines. The first line is the radius of the tray, and the second line is the radius of the coins, both of which do not exceed 4,294,967,296.
The output goes something like: "6 coins of size 2 will fit the inner rim of a tray of size 6." The number of coins is always an integer. If the coin happens to be too big to fit in a tray, output should be "Coin cannot fit in the tray.
6 coins of size 2 will fit the inner rim of a tray of size 6.
Source: Asia 2003, Manila (Philippine)