一看就是找规律的题。只要熟悉异或的性质,可以秒杀。

为了防止忘记异或的规则,可以把异或理解为半加运算:其运算法则相当于不带进位的二进制加法。

一些性质如下:

交换律

结合律

恒等律

归零律

典型应用:交换a和b的值:a=a^b^(b=a);

#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<map>
#include<set>
#include<vector>
#include<algorithm>
#include<stack>
#include<queue>
using namespace std;
#define INF 1000000000
#define eps 1e-8
#define pii pair<int,int>
#define LL long long int
int n,p;
int ans=;
int x[];
int main()
{
//freopen("in7.txt","r",stdin);
//freopen("out.txt","w",stdout);
scanf("%d",&n);
x[]=;
for(int i=; i<=n; i++)
{
x[i]=x[i-]^(i-);
int t=n/i;
if(t%==) ans^=x[i];
ans^=x[n%i+];
}
for(int i=; i<n; i++)
{
scanf("%d",&p);
ans^=p;
}
printf("%d\n",ans);
//fclose(stdin);
//fclose(stdout);
return ;
}

最新文章

  1. 元素的click与dblclick
  2. NIO源码阅读
  3. Linux常用命令02
  4. MySQL Profiling 的使用
  5. 【转】Android M新控件之AppBarLayout,NavigationView,CoordinatorLayout,CollapsingToolbarLayout的使用
  6. C#_自动化测试1_模拟post,get_12306火车票网站自动登录工具
  7. [OM]Dropship SO(直发/直运订单)的流程
  8. WebAPI通过multipart/form-data方式同时上传文件以及数据(含HttpClient上传Demo)
  9. [ios] NSURL
  10. es6笔记7^_^class
  11. 如何使用华为软件开发云快速部署PHP网站
  12. 关于 IIS 的 Management Service Delegation 配置 备份
  13. linux 常用命令 和 nginx(反响代理、负载均衡)安装和配置
  14. Codeforces Round #454 Div. 1
  15. C#批量删除注释与空行
  16. Html dom 赋值
  17. Ubuntu_安装Wiz笔记
  18. exception ORA-00918: 未明确定义列
  19. Android Bigmap的操作(绘制,裁剪)
  20. Bootstrap学习笔记(排版)

热门文章

  1. 软件磁盘阵列(RAID)
  2. 剑指offer 面试25题
  3. Java CLASSPATH
  4. Nexus Repository Manager 使用笔记
  5. Linux centos开机执行JAR Shell脚本
  6. STM32系列第15篇--灵活的静态存储控制器FSMC
  7. jQuery横向图片手风琴
  8. html5-entities.js消失问题
  9. JDBC的一些代码
  10. SQL Server technical bulletin - How to resolve a deadlock