fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone{
  9. public static void main(String[] args) {
  10. for(long i=1;i++<65;){
  11. f(i);
  12. }
  13. }
  14. static void f(long n){
  15. for(int i=-1,j;i++<31;)
  16. for(j=0;j++<34;){
  17. long a=1,x=a<<i,y=a<<j;
  18. if(x+y==n|y-x==n){
  19. System.out.println(n+": "+j+" "+i);
  20. return;
  21. }
  22. }
  23. }
  24. }
Success #stdin #stdout 0.04s 711168KB
stdin
Standard input is empty
stdout
2: 2 1
3: 1 0
4: 1 1
5: 2 0
6: 2 1
7: 3 0
8: 2 2
9: 3 0
10: 3 1
12: 3 2
14: 4 1
15: 4 0
16: 3 3
17: 4 0
18: 4 1
20: 4 2
24: 4 3
28: 5 2
30: 5 1
31: 5 0
32: 4 4
33: 5 0
34: 5 1
36: 5 2
40: 5 3
48: 5 4
56: 6 3
60: 6 2
62: 6 1
63: 6 0
64: 5 5
65: 6 0