Pro.ID22389 TitleMagic Bitstrings Title链接http://10.20.2.8/oj/exercise/problem?problem_id=22389 AC0 Submit0 Ratio- 时间&空间限制描述A bitstring, whose length is one less than a prime, might be magic. 1001 is one such string. In order to see the magic in the string let us append a non-bit x to it, regard the new thingy as a cyclic string, and make this square matrix of bits
This matrix has the same number of rows as the length of the original bitstring. The m-th row of the matrix has every m-th bit of the original string starting with the m-th bit. Because the enlarged thingy has prime length, the appended x never gets used. If each row of the matrix is either the original bitstring or its complement, the original bitstring is magic. 输入Each line of input (except last) contains a prime number p ≤ 100000. The last line contains 0 and this line should not be processed. 输出Description A bitstring, whose length is one less than a prime, might be magic. 1001 is one such string. In order to see the magic in the string let us append a non-bit x to it, regard the new thingy as a cyclic string, and make this square matrix of bits
This matrix has the same number of rows as the length of the original bitstring. The m-th row of the matrix has every m-th bit of the original string starting with the m-th bit. Because the enlarged thingy has prime length, the appended x never gets used. If each row of the matrix is either the original bitstring or its complement, the original bitstring is magic. Input Each line of input (except last) contains a prime number p ≤ 100000. The last line contains 0 and this line should not be processed. Output For each prime number from the input produce one line of output containing the lexicographically smallest, non-constant magic bitstring of length p-1, if such a string exists, otherwise output Impossible. Sample Input 5 Sample Output 0110 Source 样例输入5 样例输出0110 作者 |