#OLD121. Buy lottery tickets
Buy lottery tickets
Description
Nowadays,Jack Ma often says that he is not interested in money, nor does he take a cent from the company. But when he was young,he often dreams of making a fortune, so that he likes to buy lottery tickets.But he does not buy blindly, and after careful analysis to analyze whether each lottery ticket is worth buying.
Format
Input
There are multiple test cases. For each case, the first line contains a
integer w which means that there are the kinds of lottery tickets.
Each kind lottery ticket contains three numbers k, n, m. k represents the
price of each kind lottery ticket, n represents the number of this kind
lottery tickets sold last time, and m represents the number of awards.
The next m lines mean m awards, each line contains mi, representing Prize bonus amount, and ni represents the number of awards awarded. 0<w<=10,0<k<=10,0<n<=10^6,1<=m<=10,0<mi<=10^4,0<ni<=n(Lottery prices and bonuses are floating point)
Output
For eachlottery ticket, output case number, then output 'Great!' ,representing this kind of lottery is worth buying, or 'Not Well' ,representingthis kind of lottery is not worth buying.For each case, output the most worthwhile case numbers (if there are more than one case worth buying, output the case numbers from small to large, separated by a space).
Samples
3
2 20000 4
100 2
50 12
10 491
2 19495
2 1000 3
20 1
2 393
0.1 606
2 20000 4
100 2
50 12
10 491
2 19495
case 1: Great!
case 2: Not Well
case 3: Great!
1 3