|
||||||||||
Count ProblemTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1006 Accepted Submission(s): 594 Problem Description In this problem,we need to count the number that accord with the following rule(include the input number n).Read a integer number n(1<=n<=2^31 - 1) first,then do as following ways: (1)Do nothing, then exit the process. (2)Add a digit to the left of it,but the digit should not bigger than the half of the original first digit.For example,from 36 to 136 is legal,but 36 to 236 is illegal because 2 is bigger than half of 3. (3)After add the digit,continue the process,until could not add digit anymore. Input The first line of the input contains an integer T which means the number of test cases.Then T lines follow, each line starts with a number n(1<=n<=2^31 - 1). Output For each test case, you should output one line contains the number that accord with the rule start from n. Sample Input
Sample Output
Hint The first case 1 cannot any digital to the leftmost, so the number so only 1. The second case 6 can add 1, 2, 3 to the leftmost so 16,26,36 are legal. And then 26, 36 also can add 1 to the leftmost so get 126, 136. So 6,16,26,36,126,136 are all legal.The result is 6. Source | ||||||||||
|