求1 \bigoplus 2 \bigoplus\cdots\bigoplus N1⨁2⨁⋯⨁N 的值。html
A \bigoplus BA⨁B 即AA , BB 按位異或。spa
輸入格式:code
1 個整數NN。htm
輸出格式:blog
1 個整數,表示所求的值。get
• 對於50% 的數據,1 \le N \le 10^61≤N≤106;it
• 對於100% 的數據,1 \le N \le 10^{18}1≤N≤1018。io
打表找規律class
1 #include <cstdio> 2 3 #define LL long long 4 5 inline void read(LL &x) 6 { 7 x=0; register char ch=getchar(); 8 for(; ch>'9'||ch<'0'; ) ch=getchar(); 9 for(; ch>='0'&&ch<='9'; ch=getchar()) x=x*10+ch-'0'; 10 } 11 12 int Presist() 13 { 14 // freopen("out.txt","w",stdout); 15 LL n; read(n); 16 if(n%4==0) printf("%lld\n",n); 17 else if(n%4==1) puts("1"); 18 else if(n%4==2) printf("%lld\n",n+1); 19 else if(n%4==3) puts("0"); 20 return 0; 21 } 22 23 int Aptal=Presist(); 24 int main(int argc,char**argv){;}