You are viewing a single comment's thread. Return to all comments →
My solution public class Solution {
public static void main(String[] args) { Scanner in = new Scanner(System.in); long t =in.nextLong(); long v=3,i=1,v1=3; while(i<=t) { if(v1==1) { i=i+1; v=v*2; v1=v; } else { i=(i+v-1); v1=1; } } if(i==t) { System.out.println(v1); } else { System.out.println(i-t+1); } }
}
Seems like cookies are disabled on this browser, please enable them to open this website
Strange Counter
You are viewing a single comment's thread. Return to all comments →
My solution public class Solution {
}