1420 - Bugs
Time Limit : 10 Second
Memory Limit : 128 MB
Gaewah now developing an RPG. As many RPG, this game also can buy or sell potion in store. Each potion has a level, and same level potion has same price to buy or to sell. This game has a special system, player can freely mix 2 bottle of k-th level potions into a (k+1)-th level potion.
After game test, gaewah found there maybe some bugs. If we buy 2 bottles of 1-th level potions cost 2*25D, and sell a bottle of 2-th level potion can get 75D (D is the monetary unit in the game), then we can get infinite just through buy and sell potions.
(for special reason, the mixed potions can NOT mix a high level potion)
Now Gaewah need you write a program to check the game, can player get infinite money through buy potions, mix it and sell it?
First line is T means T test cases in total.
For each test case:
First line is an integer N and a float number f, N is there are N level potions in total, f means selling price f times of buying price. (1<N<12, 0.50<=f<=1.00)
Next N lines, each has an integer Xi indicated buying price of the i-th level potion. (0<=Xi<=1000)
Print "Case #X:" (X is the case number) at the first line of each test case.
The second line is "Yes" if player can get infinite money, or "No" if not. (Without quotation marks).
- sample input
2 2 0.75 25 100 2 0.5 25 100
- sample output
Case #1: Yes Case #2: No