ZOJ Problem Set - 3163
It was a golden autumn day when Wyest got so many apples in her house. Those cute round things seemed to be so sweet and crunchy that she loved them very much. She piled them up like a pyramid, putting one apple upon every three apples which form a equilateral triangle (the picture shows a two-leveled pile). All apples were piled into the pyramid exactly, with no surplus. Then she left and planned to come back and pick one apple to eat every noon.
Unfortunately Wyest's house was not suitable for storing fruits, and at the very night she left, the apple in one corner of the bottom level began to rot. An apple always rot more by x percent each day. If a rotting apple was touching some good apples, it would cause them also begin to rot the next day. If it was only touching other rotting apples, it would make them to rot y percent more each day, and different apples would take effect separately. Of course when an apple becomes 100% rotten, it will not rot more. As Wyest was satisfied of the pyramid, she would be careful not to take any apple in the bottom of some other apple, for doing this would cause slippping or even destroy the shape. She would only take completely good ones to eat, and if she couldn't find any such apple on the top, she'd throw some until a good one could be taken. 100% rotten apples could be thrown away freely, as long as they didn't have other apples on them. Now you're to find out at most how many apples Wyest could actually eat in the end.
There are multiple test cases, each on one line containing three integers: 0 < n <= 100000, the number of levels in the apple pile, 0 < x <= 100 and 0 <= y <= 100, which are discribed previously.
One line for each case, a single integer indicating the number of apples Wyest could eat at most.
1 10 10
A one-leveled apple pile has only one apple, and it had begun to rot before Wyest came to fetch it.
Author: WANG, Yuting
Source: ZOJ Monthly, February 2009