P3908 异或之和
题目描述
求1 \bigoplus 2 \bigoplus\cdots\bigoplus N1⨁2⨁⋯⨁N 的值。
A \bigoplus BA⨁B 即AA , BB 按位异或。
输入输出格式
输入格式:
1 个整数NN。
输出格式:
1 个整数,表示所求的值。
输入输出样例
3
0
说明
• 对于50% 的数据,1 \le N \le 10^61≤N≤106;
• 对于100% 的数据,1 \le N \le 10^{18}1≤N≤1018。
很神奇的一道题,
打表找规律
四个一循环
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#define lli long long int
using namespace std;
const int MAXN=;
const int mod=1e9+;
inline void read(int &n)
{
char c=getchar();n=;bool flag=;
while(c<''||c>'') c=='-'?flag=,c=getchar():c=getchar();
while(c>=''&&c<='') n=n*+c-,c=getchar();n=flag==?-n:n;
} int main()
{
long long n=;
cin>>n;
if(n%==) printf("");
else if(n%==) printf("");
else if(n%==)printf("%lld",n+);
else if(n%==) printf("%lld",n);
return ;
}
P3908 异或之和的更多相关文章
- 洛谷——P3908 异或之和
P3908 异或之和 题目描述 求1 \bigoplus 2 \bigoplus\cdots\bigoplus N1⨁2⨁⋯⨁N 的值. A \bigoplus BA⨁B 即AA , BB 按位异或. ...
- 洛谷 P3908 异或之和
洛谷 P3908 异或之和 题目描述 求1⨁2⨁⋯⨁N 的值. A⨁B 即 AA, B 按位异或. 输入输出格式 输入格式: 1 个整数 N . 输出格式: 1 个整数,表示所求的值. 输入输出样例 ...
- 【洛谷】P3908 异或之和(异或)
题目描述 求1 \bigoplus 2 \bigoplus\cdots\bigoplus N1⨁2⨁⋯⨁N 的值. A \bigoplus BA⨁B 即AA , BB 按位异或. 输入输出格式 输入格 ...
- 洛谷—— P3908 异或之和
https://www.luogu.org/problemnew/show/P3908 题目描述 求1 \bigoplus 2 \bigoplus\cdots\bigoplus N1⨁2⨁⋯⨁N 的值 ...
- 洛谷【P3908】异或之和
二进制前置技能:https://www.cnblogs.com/AKMer/p/9698694.html 题目传送门:https://www.luogu.org/problemnew/show/P39 ...
- HDU 5014 异或之和
http://acm.hust.edu.cn/vjudge/contest/122814#problem/H 这道题就是求异或之和 知识点: a^b = c 等价于 b^c =a 和 a^c = b ...
- 2014北邮新生归来赛解题报告a-c
<span style="font-family: Arial, Helvetica, sans-serif; background-color: rgb(255, 255, 255) ...
- 2014ACM/ICPC亚洲区北京站 上交命题
A http://acm.hdu.edu.cn/showproblem.php?pid=5112 输入n个时刻和位置,问那两个时刻间速度最快. 解法:按照时间排序,然后依次求相邻两个之间的速度,速度= ...
- HDU 5344 MZL's xor (水题)
题意:给一个序列A,设序列B的中的元素有(Ai+Aj)(1≤i,j≤n),那么求B中所有元素的异或之和.而序列A是这样来的:A1=0,Ai=(Ai−1∗m+z) mod l. 思路:相同的元素异或结果 ...
随机推荐
- jQuery第四课 点击 _选项卡效果一
//鼠标移到上面是显示手型cursor:pointer jquery 的函数: siblings //兄弟节点,同胞元素 :eq()选择器选取带有指定 index 值的元素.index 值从 0 开始 ...
- Mean, Median, Mode, Range, and Standard Deviation
Descriptive statistics tell you about the distribution of data points in data set. The most common m ...
- Docker安装MySQL忽略大小写问题的问题
原文:Docker安装MySQL忽略大小写问题的问题 连接MySQL: 查看当前mysql的大小写敏感配置show global variables like '%lower_case%';+---- ...
- POJ——T 3041 Asteroids
http://poj.org/problem?id=3041 Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 23565 ...
- 精品JS代码收藏大全
1. oncontextmenu="window.event.returnvalue=false" 将彻底屏蔽鼠标右键 <table border oncontextmenu ...
- 微信开发出现 redirect-uri參数错误原因是设置回调页面域名不要加HTTP://
OAuth2.0 网页授权设置.回调页面域名不要加HTTP:// NND 微信的研发.你程序处理下非常麻烦吗?给个提示非常麻烦吗?让我查了1个多小时.
- android:为TextView加入样式——下划线,颜色,设置链接样式及前背景色
实现下划线及颜色设置: public class AtActivity extends Activity { LinearLayout ll; /** Called when the acti ...
- 状态压缩dp初学__$Corn Fields$
明天计划上是要刷状压,但是作为现在还不会状压的\(ruoruo\)来说是一件非常苦逼的事情,所以提前学了一下状压\(dp\). 鸣谢\(hmq\ juju\)的友情帮助 状态压缩动态规划 本博文的大体 ...
- 关键字super
1.super,相较于关键字this,可以修饰属性.方法.构造器 2.super修饰属性.方法:在子类的方法.构造器中,通过super.属性或者super.方法的形式,显式的调用父类的指定 属性或方法 ...
- Lua,github,nginx
个人觉得这几种工具都是大学里,至少是前几年未曾出现于课本中或者图书馆中的.而如今确实某些公司赫然出现在招聘需求中的东西. 什么是Lua,为什么要用Lua——做手机游戏而被推广的.Lua原来早在93年就 ...