Special Christmas Tree
Time limit3sMemory limit256 MB
Find the maximum node count of a binary tree with exactly L leaves and height at most H.
Problem
Christmas is coming, everyone is building a Christmas tree, and you are no exception. You want yours to be special, so you decided to build a binary tree and hang its root from the ceiling.
In this problem a binary tree is a collection of connected nodes. The topmost node is the root. Every node has 0, 1, or 2 nodes hanging from it, called its children. A node with no children is a leaf. Every node except the root has exactly one parent.
You bought a decoration pack and you want to use all of its items to decorate all the leaves of the tree. The height of your room limits the tree, so the tree cannot be longer than the room. The height of a tree is the number of edges on the path from the root to the farthest leaf.
Each leaf must be decorated by exactly one item, each item decorates exactly one leaf, and you must use every item.
Find the most special tree. Tree X is more special than tree Y if X has more nodes than Y.
Input
The first line contains a single integer (), the number of test cases. Each of the next lines contains two integers and separated by a single space (, , ), the maximum possible height of the tree and the number of its leaves.
Output
For each test case, print one line of the form Case n: x, where is the number of the test case starting from 1 and is the number of nodes of the most special Christmas tree that has exactly leaves and height at most .