Plus
Pin


Problem description Progress
ID 39625. XOR
Темы: Number systems    Different number systems   

Exclusive "or" (XOR) is a Boolean function, as well as a logical and bitwise operation on two arguments, the result of which is true if and only if one of the arguments is true and the second is false.
Circular bit shift to the right - an operation in which the least significant digit is transferred to the beginning of the number and becomes the most significant, and all the rest are shifted to the right by one position.
To two 16-bit numbers A and B, written in hexadecimal notation, the  exclusive "or" operation was applied, and then to the result - the operation of a bitwise circular shift to the right by K bits. One of the two original numbers has been forgotten and needs to be restored.
Input
the numbers A, K and the result X are written into the string, separated by a space. The numbers A and X are given in the  hexadecimal number system, K - in decimal.
Imprint
B number.

Examples
# Input Output
1 1A2B 4 4E5D FFFF
2 AB00 1 5C9A 1234

ID 39624. To the ternary number system
Темы: Translation from 10CC    Number systems   

Given a natural number N not greater than 108 . It is required to determine how many even digits are included in its entry in the ternary number system.
Input
number N written in decimal notation.
Imprint
the number of even digits included in the record of the number N in the ternary number system.

Examples
# Input Output Explanation
1 4 0 410=113
2 15 2 1510=1203