Problem:-
You are given a number represented as a binary representation of bits. You are also given a number and a character .
Determine a number that is generated after cyclically shifting the binary representation of by positions either left if or right is .
Input format
Print integers in a separate line representing the answer to each query.
Constraints
Determine a number that is generated after cyclically shifting the binary representation of by positions either left if or right is .
Input format
- The first line contains an integer representing the number of queries.
- The next lines contain as mentioned in the problem statement.
Print integers in a separate line representing the answer to each query.
Constraints
Explanation
For first case : N in binary is 0001 1110 1100 1001 and shifting it left by 5 position, it becomes 1101 1001 0010 0011 which in decimal system is 55587
For second case : N in binary is 0001 1110 1100 1001 and shifted 3 position to right it becomes 0010 0011 1101 1001 which in decimal system is 9177
For second case : N in binary is 0001 1110 1100 1001 and shifted 3 position to right it becomes 0010 0011 1101 1001 which in decimal system is 9177
Time Limit:1.0 sec(s) for each input file.
Memory Limit:256 MB
Source Limit:1024 KB
0 Comments