Submit | All submissions | Best solutions | Back to list |
GNYR04C - Lennys Lucky Lotto Lists |
Lotto is a lottery, typically with an accumulating jackpot, in which participants play numbers of their choice in a random drawing. Lenny likes to play the lotto in Lincoln county Louisiana. In the game, he picks a list of n numbers in the range from 1 to m. If his list matches the drawn list, he wins the big prize, a lifetime supply of large lemons.
Lenny has a scheme that he thinks is likely to be lucky. He likes to choose his list so that each number in it is at least twice as large as the one before it. So, for example, if n = 4 and m = 10, then the possible lucky lists Lenny could pick are:
1 2 4 8 1 2 4 9 1 2 4 10 1 2 5 10
Thus Lenny has 4 lists to choose from.
Your job, given n and m, is to count how many lucky lists Lenny has to his disposal.
Input
The first line of input is a single non-negative integer, which is the number of data sets to follow. All data sets should be handled identically. The next lines, one per data set, contain two integers, n and m. It is guaranteed that 1 <= n <= 10 and 1 <= m <= 2000 and n <= m.
Output
For each data set, print a line like the following:
Data set i: n m number
where i is the data set number (beginning with 1), and number is the maximum number of lucky lists corresponding to the provided values of n and m.
Example
Input 1 4 10 Output Data set 1: 4 10 4
Added by: | abdelkarim |
Date: | 2013-08-13 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 |
Resource: | ACM Regionals 2004 North America - Greater NY |
hide comments
|
|||||
2017-10-28 04:13:19
Beware of blanklines in input. |
|||||
2017-08-19 23:42:34 Sigma Kappa
Speaking of DP, why it is that when I click on the "#Dynamic-Programming" tag I always end up with the same list which, for example, does not have this particular task in it? And when the "Coming-soon" feature of SPOJ will indeed come? |
|||||
2017-02-07 13:16:48
dp:-) |
|||||
2016-09-13 20:47:42
Yesss.. Nice trick :) |
|||||
2015-05-26 18:02:08 Naman Goyal
Result requires and fits in 8 byte. Doesn't fit in 4 byte. |
|||||
2015-05-24 08:21:45 pingal tirkey
DP :) |
|||||
2015-04-15 18:40:29 shikhar jindal
anyone please provide me with some tricky test cases.. |
|||||
2013-12-16 18:04:02 Apoorv Jindal
O(10*2000+t) :) Last edit: 2013-12-16 18:04:30 |
|||||
2013-09-22 15:46:01 albertg
O(n*m+t) |
|||||
2013-08-23 13:14:56 Vedernikoff Sergey
O(10 * 2000 + #testcases) for all testcases |