Skip to content

Instantly share code, notes, and snippets.

@mohitkhosla01
Created October 10, 2016 07:02
Show Gist options
  • Save mohitkhosla01/88f6b70d37a6385de25238c176ebc7df to your computer and use it in GitHub Desktop.
Save mohitkhosla01/88f6b70d37a6385de25238c176ebc7df to your computer and use it in GitHub Desktop.
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