Submit | All submissions | Best solutions | Back to list |
EC_CONB - Even Numbers |
Marina is a college girl who likes to play with all kinds of numbers. One day she was very bored and decided to play around with even numbers.
She notes N numbers on the board(odd and even numbers) and then, she modifies only even numbers (for some reason she likes the odd numbers) and inverts its binary representation and replaces each even number. But soon she gets bored and ask you help in order to automate the conversion process.
Marina is a college girl who likes to play with all kinds of numbers. One day she was very bored and decided to play around with even numbers.
She writes N numbers on the board (odd and even numbers) and then, she modifies only even numbers (for some reason she likes the odd numbers) and reversed its binary representation (from the left to the right ) and replaces each even number. But soon she gets bored and ask you help in order to automate the conversion process.
Input
In the first line contains the value of N. This integer is followed by N lines, every one with a positive integer ai (1 <= ai <= 10^7).
Output
The output will contain N lines, the numbers that are on the blackboard after the conversion process.
Example
Input: 5 10 8 3 5 2 Output: 5 1 3 5 1
Added by: | Eddy Cael |
Date: | 2013-10-12 |
Time limit: | 1s |
Source limit: | 2000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | C CSHARP C++ 4.3.2 CPP C99 HASK JAVA PYTHON RUBY |
hide comments
|
||||||||
2020-01-07 14:15:22
The first line under input takes the number of entries by the user. Don't confuse with 10 having output 1. Notice that the input has 6 lines of data entry whereas the output has just 5 lines. Hope you get my point! |
||||||||
2019-10-28 10:22:28
Warning! You can change only even number! Easy one:( |
||||||||
2019-07-16 20:38:15
Hint: stack |
||||||||
2018-10-18 16:18:23
just get the number of bits in binary representation of a number, it will help to compute answer #ACin1go my 100th on spoj Last edit: 2018-10-18 16:23:01 |
||||||||
2018-06-06 12:24:31
bin, str, int and [::] notation in python :) |
||||||||
2017-11-15 18:43:12
AC in a GO! |
||||||||
2017-09-27 11:46:00
I always wanted to comment AC in one go!!! :) use bit manipulation that's it! |
||||||||
2017-08-19 00:49:44
AC is one go ! :) |
||||||||
2017-07-02 12:26:42 rishikeshwar
@rish23101998 Binary representation of 10 is 1010 and reversing it becomes 0101 which equals to 5, which is justified in the sample output |
||||||||
2017-07-02 09:17:12
binary representation of 10 is 1010 but output given here is 1...why?? |