All submissions for this problem are available.
Chef Neel's girlfriend is angry with him. Chef wants to please her. Since she loves to play with some very large binary strings. She gives the
Chef a task to find the kth character of the string generated by the formula.
switch(String a) function returns the string having its each bit toggled i.e. if the ith character of the string was 0 it becomes 1 and vice versa.
reverse(String a) function returns the reverse of the string i.e. the ith character becomes the (n-i+1)th character of the string where n is the length of the string.
- The first line of input contains a single integer T,the number of test cases.
- For each test case, there exists a line consisting of an integer K.
- For each test case output in a new line the kth character of the strings generated by the above formula.
Input: 2 10 10876 Output: 0 1
S=001001100011011 and so on.
Tenth character in the sequence of strings is therefore 0.
Similarly the 10876th character comes out to be 1.
|Time Limit:||1 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.5, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, SCALA, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, PERL6, TEXT, SCM chicken, CLOJ, FS|
Fetching successful submissions
If you are still having problems, see a sample solution here.