|
|||||||
|
Ones And Zeros
Certain positive integers have their decimal representation consisting only of ones and zeros, and having at least one digit one, e.g. 101. If a positive integer has not such a property, one can try to multiply it by some positive integer to find out whether the product has this property. TaskWrite a program that:
InputThe file JED.IN contains in the first line a positive integer K<1000. In consecutive lines there is a sequence of K numbers in the range of [1..20000], one number per line. The numbers in the file JED.IN are written correctly, and your program need not verify that. OutputEach line of the file JED.OUT, starting with the first, should contain:
ExampleFor the file JED.IN:6 17 11011 17 999 125 173the file JED.OUT may have the following form: 11101 11011 11101 111111111111111111111111111 1000 1011001101 Your program should look for the file JED.IN in the current directory and create the file JED.OUT also in the current directory. The source file containing the program written by you should be named JED.???, where ??? are substituted by at most three-letter abbreviation of the programming language used. The same program in an executable form should be written in a file JED.EXE. * The task comes from a collection of Romanian problems. Dr. Andrzej Walat has compiled the contents and he is the author of the solutions. |