Submit | All submissions | Best solutions | Back to list |
POWEROF2 - Next power of 2 |
Wersja polska | English version |
For gven integer n print next power of 2 greater than n.
Input
The first line of the standard input contains one integer t (t<10001) which is the number of test cases.
In each of the next t lines there is an integer n (0<=n<=10^9).
Output
For each test, print the next power of 2 greater than n.
Example
Input: 5
5
4
10
16
100
Output: 8
8
16
32
128
Added by: | Piotr Kąkol |
Date: | 2010-03-21 |
Time limit: | 2.828s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: NODEJS OBJC SCM qobi VB.NET |
hide comments
|
||||||
2022-12-22 02:17:51
if you can't pass the master judge, then please check if you have considered n==0,it should output `1` |
||||||
2014-12-05 18:15:09 Piotr KÄ…kol
Method 'Bool' not found for invocant of class 'Integer' |
||||||
2014-12-05 17:32:25 Kurt Schwind
Getting NZEC on Sub # 13071477. Any ideas? -- "2014-12-05 18:15:09 Piotr Kąkol Method 'Bool' not found for invocant of class 'Integer'" Thanks for the response. I can't re-create this error. I think it's because I'm on perl6 2013.02.1. I can't change the behaviour of my binary to fail in that same way. Last edit: 2014-12-05 19:06:10 |
||||||
2013-11-21 22:36:52 Mitch Schwartz
@Dominique @Piotr: Thanks! Likewise congrats Dominique on TR_GRID, FACT_FUN, and the various other top scores (overall or language specific) you've gotten recently! You guys (and Wasi too) should join the IRC channel from time to time. :) It's usually pretty quiet, but I'm on there most of the time (although if I'm not at my home computer I may not see messages until later), and hallvabo, Jander, and primo are there a lot of the time too. |
||||||
2013-11-20 02:18:36 Piotr KÄ…kol
There's nothing better than seeing the shortest code beaten in an old task. :-) |
||||||
2013-11-19 22:37:11 Dominique VAILLANT
@Mitch: Great! |
||||||
2013-07-02 08:27:35 orange
don't forget 0 Last edit: 2013-07-02 08:37:52 |
||||||
2012-08-21 14:10:11 Piotr KÄ…kol
@hallvabo - All programs in all tasks has been rejudged. |
||||||
2012-08-13 18:09:10 Hallvard Norheim Bø
@numerix: I suspected that was the case here, as it also happened in FIBON (fixed by Piotr now). At least it motivated me to shorten my own solutions ;) |
||||||
2012-08-13 08:58:56 numerix
@hallvabo: No, it's an old Python 2.6 submission, later relabeled as 3.1.2. |