Advertisement
Patrickmeme

Intervalxor

Jun 11th, 2023
608
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.67 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int i,a,z,xr,n,ca,cz,max1,j,k;
  8.     cin>>n;
  9.     for (k=0;k<n;k++){
  10.         cin>>a;
  11.         ca=a;
  12.         z=a%4+1;
  13.         if(z==1)
  14.             z=5;
  15.        // printf("(%d)",z);
  16.         cz=z;
  17.         xr=0;
  18.         while(z>0){
  19.             xr=xr^a;
  20.             a--;
  21.             z--;
  22.         }
  23.         cout<<xr<<" ";
  24.         /*z=cz;a=ca;max1=xr;
  25.         for(i=0;i<z;i++){
  26.             xr=0;
  27.             for(j=0;j<i;j++)
  28.                 xr=xr^(a-j);
  29.             for(j=i+1;j<z;j++)
  30.                 xr=xr^(a-j);
  31.             max1=max(xr,max1);
  32.         }
  33.         cout<<max1<<"\n";*/
  34.     }
  35.     return 0;
  36. }
  37.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement