[Huawei OD machine test 2023 latest] Symmetrical aesthetics (100% C language problem solving)

topic description

Symmetry is the greatest aesthetics, and there is an aesthetics about symmetrical strings. A known:

  • 1st string: R
  • 2nd string: BR
  • 3rd string: RBBR
  • 4th string: BRRBBRBBR
  • 5th string: RBBRBRRBBRRBBRBR

I believe you have discovered the pattern, yes! That is, the i-th string = the inversion of the i-th string + the i-1 string;

negate(R->B, B->R);

Now tell you n and k, let you find out what is the kth character of the nth string. (The number of k starts from 0)

enter description

Enter a T in the first line, indicating that there are T groups of use cases;

Parsing to input T lines, each line enters two numbers, representing n, k

  • 1 ≤ T ≤ 100;
  • 1 ≤ n ≤ 64;
  • 0 ≤ k < 2^(n-1);

lose

Guess you like

Origin blog.csdn.net/shangyanaf/article/details/130233576