Mixing in base 2 P42672


Statement
 

pdf   zip

thehtml

Given a natural number x > 0 with n bits, we denote with xn−1x0 its representation in base 2. For example, x = 8 in base 2 is 1000, so x3 = 1 and x2 = x1 = x0 = 0.

Write a program to mix the base 2 representations of two given natural numbers x and y with the same number of bits n. That is, print xn−1 yn−1x0 y0.

Input

Input consists of several cases, each with two natural numbers with the same number of bits, between 1 and 30.

Output

For every case, print the mixing of the representations in base 2 of the two numbers.

Public test cases
  • Input

    8 15
    1 1
    2 3
    1000 600
    900000 1000000
    

    Output

    11010101
    11
    1101
    11101011100111000000
    1111011110011010100011101001100000000000
    
  • Information
    Author
    Salvador Roura
    Language
    English
    Translator
    Salvador Roura
    Original language
    Catalan
    Other languages
    Catalan
    Official solutions
    C++ Java Python
    User solutions
    C C++ Python