Posts

Showing posts from October, 2020

Machine :) (Codechef Contest Problem)

  Question:- Charlie found a machine while on exploration. He brought the machine to you but you realize that first you need to unlock the machine with a series of steps. Luckily, Charlie had also found a paper containing series of numbers to unlock the machine in  T  steps. Each step requires an input  K  to proceed. But unfortunately, the key of digit  7  is broken. You also find out that instead of a single input, you can give two inputs for each step such that the result adds upto  K . Since the key  7  is broken, you proceed with the option of breaking up the number into two parts so that you can avoid entering the digit  7 . Your job is to write a program which will break  K into two parts  a  and  b  such that  K = a + b  and neither of  a  or  b  has digit  7 . Example: K = 3576 can be broken into a = 1633 and b = 1943 Input: First line will contain  T , number of steps. Then the steps follow. Each step contains of a single line of input, a integer  K Output: For each testcase,