11144 - I2P(I)2016_Yang_mid1_practice1   

Description

Transform the input x, into y bits 2’s complement.

The procedure of transforming an positive integer into its two’s complement is showed as follow:

Step1: transform the input into y-bits binary representation.

Step2: toggle each bits of the binary representation.

Step3: add 1 to the binary representation.

For example,

Input: 28 33

Step1: transform integer into binary representation, 28 -> 000000000000000000000000000011100

Step2: toggle each bits -> 111111111111111111111111111100011

Step3: add 1 -> 1111111111111111111111100100

So, the two’s complement representation of 28 is 111111111111111111111111111100100.

Example2:

Input: 10 34

Step1: transform integer into binary representation, 10 -> 0000000000000000000000000000001010

Step2: toggle each bits -> 1111111111111111111111111111110101

Step3: add 1 -> 1111111111111111111111111111110110

So, the two’s complement representation of 10 is 1111111111111111111111111111110110.

 

Don't forget to print a newline in the end.

Input

Two positive integer x and y, where 0 < x < 2^32, and 32 < y < 100

Output

Two’s complement of x

Sample Input  Download

Sample Output  Download

Tags




Discuss