Machine SOLUTIONS SC_05 CODECHEF

Machine SOLUTIONS SC_05 CODECHEF

Problem Statement

Charlie found a machine while on investigation. He carried the machine to you however you understand that first you have to open the machine with a progression of steps. Fortunately, Charlie had additionally discovered a paper containing arrangement of numbers to open the machine in T steps. Each progression requires an information K to continue. In any case, sadly, the key of digit 7 is broken. 
 
You additionally discover that rather than a solitary information, you can give two contributions for each progression with the end goal that the outcome includes upto K. Since the key 7 is broken, you continue with the alternative of separating the number into two sections so you can abstain from entering the digit 7. 
 
Your main responsibility is to compose a program which will break K into two sections an and b with the end goal that K=a+b and neither of an or b has digit 7. 
 
Model: K=3576 can be broken into a=1633 and b=1943 
 
Info: 
 
First line will contain T, number of steps. At that point the means follow. 
 
Each progression contains of a solitary line of information, a whole number K. 
 
Yield: 
 
For each testcase, yield in a solitary line an and b isolated by space. In the event that there are various right answers print any. 
 
Limitations 
 
1≤T≤105 
 
2≤K≤10100 
 
It is ensured that every K will have in any event one digit as 7. 
 
Subtasks 
 
The complete imprints will be separated into: 
 
5% : 1≤K≤105 
 
10% : 1≤K≤1010 
 
15% : 1≤K≤1020 
 
25% : 1≤K≤1050 
 
45% : 1≤K≤10100 
 
Test Input: 
 
 
2745 
 
47736 
 
175 
 
976 
 
3777 
 
Test Output: 
 
1186 1559 
 
8420 39316 
 
83 92 
 
311 665 
 
1584 2193 
 
Clarification: 
 
For each progression, yield an and b wholes upto K and don’t contain digit 7 : 
 
1186+1559=2745 
 
8420+39316=47736 
 
83+92=175 
 
311+665=976 
 
1584+2193=3777 
 
There could be different answers, all answers which result in K=a+b and where an and b don’t contain a digit 7 will be acknowledged.
 

Leave a Comment