https://www.luogu.org/problemnew/show/P3908

题目描述

求1 \bigoplus 2 \bigoplus\cdots\bigoplus N1⨁2⨁⋯⨁N 的值。

A \bigoplus BA⨁B 即AA , BB 按位异或。

输入输出格式

输入格式:

1 个整数NN。

输出格式:

1 个整数,表示所求的值。

输入输出样例

输入样例#1: 复制

3
输出样例#1: 复制

0

说明

• 对于50% 的数据,1 \le N \le 10^61≤N≤106;

• 对于100% 的数据,1 \le N \le 10^{18}1≤N≤1018。

打表找规律

 #include <cstdio>

 #define LL long long

 inline void read(LL &x)
{
x=; register char ch=getchar();
for(; ch>''||ch<''; ) ch=getchar();
for(; ch>=''&&ch<=''; ch=getchar()) x=x*+ch-'';
} int Presist()
{
// freopen("out.txt","w",stdout);
LL n; read(n);
if(n%==) printf("%lld\n",n);
else if(n%==) puts("");
else if(n%==) printf("%lld\n",n+);
else if(n%==) puts("");
return ;
} int Aptal=Presist();
int main(int argc,char**argv){;}

洛谷—— P3908 异或之和的更多相关文章

  1. 洛谷 P3908 异或之和

    洛谷 P3908 异或之和 题目描述 求1⨁2⨁⋯⨁N 的值. A⨁B 即 AA, B 按位异或. 输入输出格式 输入格式: 1 个整数 N . 输出格式: 1 个整数,表示所求的值. 输入输出样例 ...

  2. 洛谷——P3908 异或之和

    P3908 异或之和 题目描述 求1 \bigoplus 2 \bigoplus\cdots\bigoplus N1⨁2⨁⋯⨁N 的值. A \bigoplus BA⨁B 即AA , BB 按位异或. ...

  3. 【洛谷】P3908 异或之和(异或)

    题目描述 求1 \bigoplus 2 \bigoplus\cdots\bigoplus N1⨁2⨁⋯⨁N 的值. A \bigoplus BA⨁B 即AA , BB 按位异或. 输入输出格式 输入格 ...

  4. 洛谷P3760异或和

    传送门啦 传送门啦 一般这种位运算的题都要把每一位拆开来看,因为位运算每个位的结果这和这一位的数有关. 这样我们用s[i]表示a的前缀和,即 $ a[1]+a[2]+....a[i] $ ,然后我们从 ...

  5. 洛谷——P3909 异或之积

    P3909 异或之积 题目描述 对于A_1,A_2,A_3,\cdots,A_NA1​,A2​,A3​,⋯,AN​,求 (6\times \sum_{i=1}^N\sum_{j=i+1}^N\sum_ ...

  6. 洛谷 P3909 异或之积 题解

    原题链接 本人看了其它解法,发现本人的解法还是 首创 ! 而且我的解法好像和 \(\times 6\) 没什么关系 -- (如果没 \(\times 6\),我没还不用算逆元) 别人的思路呢,大都是从 ...

  7. 洛谷P1286 两数之和

    这个题.. 刚开始没看见输入若干行,所以有的点就.. 令 m = n * (n - 1) / 2 已知 s = {s (1), s(2), ..., s(m)}, s(i) <= s(i+1) ...

  8. P3908 异或之和

    题目描述 求1 \bigoplus 2 \bigoplus\cdots\bigoplus N1⨁2⨁⋯⨁N 的值. A \bigoplus BA⨁B 即AA , BB 按位异或. 输入输出格式 输入格 ...

  9. 【洛谷】P1009阶乘之和

    题目链接:https://www.luogu.org/problemnew/show/P1009 题意:给一个整数n(n<50),求$ \sum^{n}_{i=1} i! $ 题解:我..拿py ...

随机推荐

  1. 《数据结构》C++代码 栈与队列

    线性表中,先进先出的叫队列,先进后出的叫栈.队列常用于BFS,而在函数递归层数过高时,需要手动实现递归过程,这时候便需要写一个“手动栈”. 有时候,我们会有大量数据频繁出入队列,但同时存在其内的元素却 ...

  2. centos6安装openfire(mysql)

    一.安装JDK 我的系统是centos6.8x64,首先安装jdk1.7.0 二.安装openfire 我装的包是:openfire-3.9.3-1.i386.rpm,复制到/opt目录 #rpm - ...

  3. ASP.NET Core [3]:进入HttpContext的世界(笔记)

    原文链接:http://www.cnblogs.com/RainingNight/p/httpcontext-in-asp-net-core.html HttpContext是ASP.NET中的核心对 ...

  4. (原、整)Unreal源码 CoreUbject- Uobject

    (原.整) Unreal源码 CoreUbject- Uobject 类别                    [随笔分类]Unreal源码搬山 @author:白袍小道 随缘那啥 这里还是属于UE ...

  5. C# http Post与Get方法控制继电器

    ---恢复内容开始--- using System; using System.Collections.Generic; using System.Linq; using System.Text; u ...

  6. usb host和device的关系-ARM 论坛 - 21ic电子技术论坛

    usb host和device的关系 疑问1:我们通常所用的u盘应该是usb device吧?我想这个不用多说,呵呵. ===============恩.============== 疑问2:我们通常 ...

  7. intellij idea 2017 快捷键(提高工作效率)

    1.Shift+Enter Annotation annotation = c.getAnnotation(A.class); 这个时候你写代码的时候可能光标在c.getAnno中的某一个位置,那么你 ...

  8. ci重写 配置文件

    server { listen 80; #listen [::]:80; server_name wangyongshun.xyz www.wangyongshun.xyz; index index. ...

  9. H5单文件压缩插件

    单文件压缩上传 <input type="file" id="file"> 构造函数 function UpFileImg(options){ va ...

  10. 解决某些PC站在手机端宽度显示不正常的问题

    可以打开控制台查看html标签的宽度,发现不是当前屏幕的宽度,更改下宽度即可:用js控制下,上代码 document.getElementsByTagName('html')[0].style.wid ...