Dazzling AXNODR Challenge Codechef Solution | APRIL CHALLENGE

Codechef
Share:

Dazzling AXNODR Challenge Codechef Solution

Dazzler has a blank canvas and (N−1)(N−1) colours numbered from 22 to NN.
Let BB denote the beauty of the canvas. The beauty of a blank canvas is 11.

Dazzler paints the canvas by using all the (N−1)(N−1) colours exactly once. On applying the ithith colour (2≤i≤N)(2≤i≤N):

  • If ii is odd, B=BB=B && ii.
  • If ii is even, B=B⊕iB=B⊕i.

Find the beauty of the canvas after applying all (N−1)(N−1) colours.

Note: The colours are applied in ascending order. Colour number 22 is applied first. The ithith numbered colour is applied after (i−1)th(i−1)th numbered colour for all i>2i>2.

Here && and ⊕⊕ denote the bitwise AND and bitwise XOR operations respectively.

Input Format

  • First line will contain TT, the number of test cases. Then the test cases follow.
  • Each test case contains of a single line of input, a single integer NN.

Output Format

For each test case, output a single integer, the beauty of the canvas after applying all (N−1)(N−1) colours.

Constraints

  • 1≤T≤1051≤T≤105
  • 2≤N≤10162≤N≤1016

Sample Input 1 

2
4
10

Sample Output 1 

7
3

Explanation

Initially, B=1B=1.

  • On applying colour 22: Since 22 is even, B=B⊕2=1⊕2=3B=B⊕2=1⊕2=3.
  • On applying colour 33: Since 33 is odd, B=B&3=3&3=3B=B&3=3&3=3.
  • On applying colour 44: Since 44 is even, B=B⊕4=3⊕4=7B=B⊕4=3⊕4=7.
  • On applying colour 55: Since 55 is odd, B=B&5=7&5=5B=B&5=7&5=5.
  • On applying colour 66: Since 66 is even, B=B⊕6=5⊕6=3B=B⊕6=5⊕6=3.
  • On applying colour 77: Since 77 is odd, B=B&7=3&7=3B=B&7=3&7=3.
  • On applying colour 88: Since 88 is even, B=B⊕8=3⊕8=11B=B⊕8=3⊕8=11.
  • On applying colour 99: Since 99 is odd, B=B&9=11&9=9B=B&9=11&9=9.
  • On applying colour 1010: Since 1010 is even, B=B⊕10=9⊕10=3B=B⊕10=9⊕10=3.

Test case 11: There are 33 colours numbered 2,3,2,3, and 44. Initially, B=1B=1.
The final beauty of the canvas is 77.

Test case 22: There are 99 colours numbered 2,3,4,5,6,7,8,9,2,3,4,5,6,7,8,9, and 1010. Initially, B=1B=1.
The final beauty of the canvas is 33.

Dazzling AXNODR Challenge Codechef  SOLUTION

Download Code
login to google play console, youtube video search by image, how to add a google account, which are the google apps, what is the google app, how to add a new google account, all the google apps, which service is the part of google, adsetting google, google data studio, google DNS, GCP console, bigquery, google studio, google api console, google app engine, anthos, google apis, google public DNS, google audio, google launcher, gcloud console, google compute engine, google webmaster console, google logged-in devices, gdrive unlimited,google console tools,google studio login,my google voice,hey google service,find similar images google, my google forms, www google com bd search, search using images in google,google image search scan,google sea console,website console google, google sound, gdrive storage for students, google site console, google console login, webmaster console, searc h console, google server down, google backup login, photo finder google, google products and services, google console tool, google image check, google cloud search is used for, google dashboard studio, google voice and audio activity,gcp dashboards, google services down, google go app, google dns down, google image identifier,check picture on google,google new launcher,google image finder online,image check google google google go, image finder on google, finding images on google, photo find google, find a picture in google, find the photo on google, picture find google, image find on google, find with photo google, image finder google online, google find with image, photo finder in google, google find image search, search using image in google, search on google with image, google server down today, google server down news

Read More Post Here

Leave a Comment

Your email address will not be published. Required fields are marked *

x