Created
October 10, 2016 07:02
-
-
Save mohitkhosla01/88f6b70d37a6385de25238c176ebc7df to your computer and use it in GitHub Desktop.
This file contains hidden or 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
import java.util.Scanner; | |
public class strangeCode { | |
public static void main(String[] args) { | |
Scanner sc=new Scanner(System.in); | |
long t=sc.nextLong(); | |
long s=3; | |
while(true){ | |
if((2*s)>(t+2)){ | |
break; | |
} | |
else{ | |
s*=2; | |
} | |
} | |
if(t!=(s-2)){ | |
s-=(t-(s-2)); | |
} | |
System.out.println(s); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment