SOJ-4309 Sum of xor
来源:互联网 发布:警用手铐淘宝有的买吗 编辑:程序博客网 时间:2024/04/29 20:17
由n^(n+1)=1,n为偶数即可分类求得。
1^1=0,0^1=1,0^0=0,异或满足交换律。
#include<iostream>#include<cstdio>#include<cstring>typedef long long LL;using namespace std ;LL get_ans(LL n){ if(n&1) return (n-1)%4==0?1:0; return (n-2)%4==0? n^1:n;}int main(){LL n; while(scanf("%lld",&n)!=EOF){printf("%lld\n",get_ans(n)); } return 0 ;}
- SOJ-4309 Sum of xor
- Sum of xor
- SOJ-4310 Sum of product
- SOJ 1259. Sum of Consecutive Primes
- soj 11598. XOR
- Sum of xor NOIp2013-Training Series #2
- Smart OJ 2484 Sum of xor 思维题 [二星]
- SOJ.Sum Fun
- hdu4825 Xor Sum【Trie、Xor】
- UVALIVE 4682: XOR Sum
- HDU 4825 Xor Sum
- 网络教室 Xor Sum
- hdu 4825 Xor Sum
- HDU 4825 Xor Sum
- HDOJ 4825 Xor Sum
- HDU-4825 Xor Sum
- HDU 4825 Xor Sum
- Xor Sum HDU
- 钻石图形
- 今天开博记录生活工作的点点滴滴
- SDRAM工作原理及S3C2410 SDRAM控制器配置方法(2)
- 驱动对象(DRIVER_OBJECT)
- Android 随笔(一)
- SOJ-4309 Sum of xor
- UVa 12502 Three Families (想法题)
- 【EasyUse】一键式检索框-界面美化参考。MFC自绘对话框加图和Button
- HDU 1247 Hat’s Words(字典树)
- 十分钟教你打造一个微信语音点歌系统
- 日常管理第一篇
- c语言时间函数
- Android中悬浮窗口的实现原理和示例代码
- 第十五周 项目2--杨辉三角