Atcoder Beginner Contest 121D(异或公式)
#include<bits/stdc++.h>
using namespace std;
int main(){
long long a,b;
cin>>a>>b;
a--;
long long tmp=a;
if(tmp&1)
tmp=0;
long long tot=a;
if(tot%4==1||tot%4==2)
tot=1;
else
tot=0;
long long tt=tmp+tot;
long long ttmp=b;
if(ttmp&1)
ttmp=0;
long long ttot=b;
if(ttot%4==1||ttot%4==2)
ttot=1;
else
ttot=0;
long long ttt=ttmp+ttot;
long long ans=tt^ttt;
cout<<ans;
return 0;
}
/* f(1, n) = f(0, n) =
n n % 4 == 0
1 n % 4 == 1
n +1 n % 4 == 2
0 n % 4 == 3
f(a,b)=f(1,b)^f(1,a-1)*/
Atcoder Beginner Contest 121D(异或公式)的更多相关文章
- AtCoder Beginner Contest 172 题解
AtCoder Beginner Contest 172 题解 目录 AtCoder Beginner Contest 172 题解 A - Calc B - Minor Change C - Tsu ...
- AtCoder Beginner Contest 154 题解
人生第一场 AtCoder,纪念一下 话说年后的 AtCoder 比赛怎么这么少啊(大雾 AtCoder Beginner Contest 154 题解 A - Remaining Balls We ...
- AtCoder Beginner Contest 173 题解
AtCoder Beginner Contest 173 题解 目录 AtCoder Beginner Contest 173 题解 A - Payment B - Judge Status Summ ...
- AtCoder Beginner Contest 169 题解
AtCoder Beginner Contest 169 题解 这场比赛比较简单,证明我没有咕咕咕的时候到了! A - Multiplication 1 没什么好说的,直接读入两个数输出乘积就好了. ...
- AtCoder Beginner Contest 238 A - F 题解
AtCoder Beginner Contest 238 \(A - F\) 题解 A - Exponential or Quadratic 题意 判断 \(2^n > n^2\)是否成立? S ...
- AtCoder Beginner Contest 100 2018/06/16
A - Happy Birthday! Time limit : 2sec / Memory limit : 1000MB Score: 100 points Problem Statement E8 ...
- AtCoder Beginner Contest 052
没看到Beginner,然后就做啊做,发现A,B太简单了...然后想想做完算了..没想到C卡了一下,然后还是做出来了.D的话瞎想了一下,然后感觉也没问题.假装all kill.2333 AtCoder ...
- AtCoder Beginner Contest 053 ABCD题
A - ABC/ARC Time limit : 2sec / Memory limit : 256MB Score : 100 points Problem Statement Smeke has ...
- AtCoder Beginner Contest 136
AtCoder Beginner Contest 136 题目链接 A - +-x 直接取\(max\)即可. Code #include <bits/stdc++.h> using na ...
随机推荐
- CSS a 标签样式
CSS a 标签样式 a:LINK { color: red; } a:VISITED { color: yellow; } a:HOVER { color: green; } a:ACTIVE { ...
- 算法初步——two pointers
什么是 two pointers 以一个例子引入:给定一个递增的正整数序列和一个正整数 M,求序列中的两个不同位置的数 a 和 b,使得它们的和恰好为 M,输出所有满足条件的方案. 本题的一个最直观的 ...
- UIWidget
[UIWidget] UIWidget在NGUI中的层次如下. 根据上篇所述,UIRect实现实现了Anchor功能.而Widget提供的功能也很简单,如下: 可以看到,widget只提供四个属性,a ...
- Project2--Lucene的Ranking算法修改:BM25算法
原文出自:http://blog.csdn.net/wbia2010lkl/article/details/6046661 1. BM25算法 BM25是二元独立模型的扩展,其得分函数有很 ...
- 闲来无事,做做Google:21 道能力倾向测试面试题
1. Solve this cryptic equation, realizing of course that values for Mand E could be interchanged. No ...
- 读excle
1.OleDbConnection读取Excel ///<summary>///上传文件到临时目录中 ///</ummary>private void Upload(){ Ht ...
- Python中sort与sorted函数
python中列表的内置函数sort()可以对列表中的元素进行排序,而全局性的sorted()函数则对所有可迭代的序列都是适用的: 并且sort()函数是内置函数,会改变当前对象,而sorted()函 ...
- linux下mariadb的下载与卸载
Linux下mariadb的安装 使用阿里云的mariadb yum install mariadb-server mariadb -y 启动mariadb数据库 systemctl start/st ...
- excel中COUNTIF的使用
=(COUNTIF(D9:AH9,"●")+COUNTIF(D7:AH7,"●"))*0.5
- .Net插入大批量数据
1. 使用SqlDataAdapter /// <summary> /// 实现数据库事务,大批量新增数据 /// </summary> ...