Let me introduce an easy game to you: give you n integers in a line you must put (n-1) operators ("+","-","*" ,"/") between any two adjacent integers to combine them into a number(In the given order). At last the result mustn't have the digit k (0<=k<=9). You must find the largest result number that doesn't have the digit k.
Note:
(1) Mathematical operators work from left to right without any other regard for order of precedence. (i.e. 6 + 7 * 11 = 143)
(2) Every subtraction will produce a nonnegative result. So a - b actully means |a - b| (the absolute value). (i.e. 2 - 5 = 3)
(3) All divisions are integer divisions. (i.e 7 / 5 = 1). And of course the number zero cannot be a divisor.
Input
Standard input will contain multiple test cases. The first line of the input is a single integer T (1 <= T <= 200) which is the number of test cases. T consecutive test cases follow.
The first line of each test case is two numbers n and k (2<=n<=9,0<=k<=9). The second line of each test case is n nonnegative integers less than 100. Process to End Of File.
Output
For each test case output the largest result number that doesn't cotain the digit k. If there is no such number, output "No result" instead.
Sample Input
2
3 5
1 2 5
2 1
11 10
Sample Output
10
No result
http://www.cnblogs.com/zsboy/archive/2013/03/12/2954979.html