Created
July 7, 2014 14:37
-
-
Save kevtainer/2b8d3cf58169c8e48d99 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
while($f = fgets(STDIN)){ | |
$input[] = (int)$f; | |
} | |
for($testcases=$input[0],$i=0;$i<$testcases;$i++) { | |
$out = 1; | |
for($cycles=$input[$i+1],$cycle_count=0;$cycle_count <= $cycles;$cycle_count++) { | |
if ($cycle_count != 0) { | |
if ($cycle_count%2==1) { | |
$out*=2; | |
} else { | |
$out+=1; | |
} | |
} | |
} | |
echo $out."\n"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment