分类:
2009-06-18 10:39:45
Time Limit:1s | Memory limit:32M |
Accepted Submit:12 | Total Submit:65 |
Description
Nancy has bought a lottery. The lottery numbers are positive integers. The prized lottery numbers are determined by randomizing two integers m and k (m>=0, k>=1). Any lottery number that contains m 0's can be prized, and the kth number is the first prize if all the prized numbers are sorted in an ascending order. Nancy won the first prize with a lucky number, for the number of digits and the leftmost digit in the first prized number happen to make up the date of Nancy's birthday. Can you work out Nancy's birthday?Input
The first line in the input is an integer N representing the number of test cases. The following N lines are N test cases. Each line contains two integers separated by one space , where the first integer is m and the second is k (0<=m<=10,1<=k<=10^12).Output
For each test case, output a line containing two integers separated by one space, where the first integer is the number of digits in the first prized number and the second integer is the leftmost digit in the first prized number.Sample Input
2
1 5
2 15
Output for the Sample Input
2 5
4 1
|