Error
|
|
---|---|
@Ibrahim Nash | 5761 |
@blackshadows | 5701 |
@akhayrutdinov | 5111 |
@mb1973 | 4989 |
@Quandray | 4944 |
@saiujwal13083 | 4506 |
@sanjay05 | 3762 |
@marius_valentin_dragoi | 3516 |
@sushant_a | 3459 |
@verma_ji | 3341 |
@KshamaGupta | 3318 |
Complete Leaderboard | |
|
|
@aroranayan999 | 938 |
@bt8816103042 | 739 |
@SHOAIBVIJAPURE | 428 |
@codeantik | 412 |
@SherlockHolmes3 | 407 |
@neverevergiveup | 348 |
@mahlawatep | 347 |
@shalinibhataniya1097 | 343 |
@murarry3625 | 333 |
@saiujwal13083 | 326 |
@rohitanand | 314 |
Complete Leaderboard |
Given a binary string S . The task is to perform R iterations on string S, in each iteration 0 becomes 01 and 1 becomes 10. Find the Nth character of the string after performing R iterations.
Input:
The first line consists of an integer T i.e number of test cases. The first and only line of each test case contains string S, and two Integers R and N respectively.
Output:
For each test case print the Nth character of string S after Rth iterations in new line.
Constraints:
1<=T<=100
1<=|string length|<=1000
1<=R<=20
0<=N<|Length of final string|
Example:
Input:
2
101 2 3
11 1 3
Output:
1
0
We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?
Yes