当前位置:网站首页>[51nod p2653] interval XOR [bit operation]
[51nod p2653] interval XOR [bit operation]
2022-06-13 09:35:00 【Ayane.】
analysis :
Record [ 1 , b ] [1,b] [1,b] and [ 1 , a − 1 ] [1,a-1] [1,a−1] Exclusive or values A , B A,B A,B And prefixes and similar The answer is A x o r B A~xor~B A xor B
CODE:
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#define reg register
using namespace std;
typedef long long ll;
int a,b,ans,ans2;
int main(){
scanf("%d%d",&a,&b);
for(int i=1;i<=b;i++) ans^=i;
for(int i=1;i<a;i++) ans2^=i;
printf("%lld",ans^ans2);
return 0;
}
边栏推荐
- IP address introduction
- Calculate the number of days between two times (supports cross month and cross year)
- Biden: hope to sign the bipartisan gun safety reform bill as soon as possible
- LeetCode 6097. 替换字符后匹配(字典)
- Online debugging tool Arthas Foundation
- @Value不生效及extend/implement其他类无法注入bean的手动注入
- C language: deep understanding of pointers and arrays
- LeetCode 1143. Longest common subsequence
- Exercise 7-10 finding specified characters (15 points)
- HAProxy + Keepalived实现MySQL的高可用负载均衡
猜你喜欢

Acwing785. quick sort (sort+ quick sort + merge sort)

VGA常用分辨率及计算方法

C language: dynamic memory management

Figure: concept of figure

全新BMW i3的操控,能符合对3系之名产品的期待吗?

攻防世界PWN play 条件竞争漏洞的利用
![1-2 24:00 (20 points) [CSP certification true question]](/img/3b/fe2c0e46dca604e5906d9c5ceabbe3.jpg)
1-2 24:00 (20 points) [CSP certification true question]

(bfs) acwing 844. Labyrinth

C language: five custom types

Jenkins接入Openldap用户认证
随机推荐
Instruction level parallelism (?)
【 ssl2 ⁶⁶⁶⁶⁶⁶⁶⁶⁶⁶⁶⁶⁶⁶⁶⁶⁶⁶⁶83
acwing 789. Range of numbers (dichotomy + suitable for understanding dichotomy boundary)
C language: data storage in memory
The turtle library displays the system time
Classes and objects -- polymorphic
LeetCode 1. Sum of two numbers
[51nod p3111] xiaoming'ai intercepts [Las]
Online debugging tool Arthas Foundation
C language: five custom types
LeetCode 1143. Longest common subsequence
(dp+ memory) acwing 901 skiing
Jenkins集成Ldap,Ldap配置错误导致jenkins用户登录失败问题解决
C/s model and P2P model
LeetCode 322. 零钱兑换
LeetCode 6097. Match after replacing characters (Dictionary)
C language: Simulated Implementation of library function strcpy
C#入门系列(十三) -- 初识结构体
攻防世界-PWN-shell
Classes and objects -- encapsulation
