等差数列连续异或模板
网上找的模板,还不太懂,改了下,先留着
#include <cstdio>
#include <ctime>
#include <cstdlib>
#include <cstring>
#include <queue>
#include <string>
#include <set>
#include <stack>
#include <map>
#include <cmath>
#include <vector>
#include <iostream>
#include <algorithm>
#include <bitset>
#include <fstream>
using namespace std;//LOOP
#define FF(i, a, b) for(int i = (a); i < (b); ++i)
#define FE(i, a, b) for(int i = (a); i <= (b); ++i)
#define FED(i, b, a) for(int i = (b); i>= (a); --i)
#define REP(i, N) for(int i = 0; i < (N); ++i)
#define CLR(A,value) memset(A,value,sizeof(A))
#define FC(it, c) for(__typeof((c).begin()) it = (c).begin(); it != (c).end(); it++)//OTHER
#define SZ(V) (int)V.size()
#define PB push_back
#define MP make_pair
#define all(x) (x).begin(),(x).end()//INPUT
#define RI(n) scanf("%d", &n)
#define RII(n, m) scanf("%d%d", &n, &m)
#define RIII(n, m, k) scanf("%d%d%d", &n, &m, &k)
#define RIV(n, m, k, p) scanf("%d%d%d%d", &n, &m, &k, &p)
#define RV(n, m, k, p, q) scanf("%d%d%d%d%d", &n, &m, &k, &p, &q)
#define RS(s) scanf("%s", s)//OUTPUT
#define WI(n) printf("%d\n", n)
#define WS(n) printf("%s\n", n)//debug
//#define online_judge
#ifndef online_judge
#define debugt(a) cout << (#a) << "=" << a << " ";
#define debugI(a) debugt(a) cout << endl
#define debugII(a, b) debugt(a) debugt(b) cout << endl
#define debugIII(a, b, c) debugt(a) debugt(b) debugt(c) cout << endl
#define debugIV(a, b, c, d) debugt(a) debugt(b) debugt(c) debugt(d) cout << endl
#else
#define debugI(v)
#define debugII(a, b)
#define debugIII(a, b, c)
#define debugIV(a, b, c, d)
#endiftypedef long long LL;
typedef unsigned long long ULL;
typedef vector <int> VI;
const int INF = 0x3f3f3f3f;
const double eps = 1e-10;
const int MOD = 100000007;
const int MAXN = 1000010;
const double PI = acos(-1.0);LL Get(LL dis, LL l, LL P, LL number)
{LL ret = 0;ret += (l / P) * number;l %= P;ret += (dis / P) * number * (number - 1) / 2;dis %= P;if (dis * number + l < P)return ret;elsereturn ret + Get(P, (dis * number + l) % P, dis, (dis * number + l) / P);
}LL GetYiHuo(LL l, LL r, LL dis) //以x开始, y为结束, dis为等差 连续异或
{//number为计算的个数LL number = (r - l) / dis + 1, ans = 0, Sum, P = 1;for (LL i = 1; i <= 10; i++){Sum = Get(dis, l, P, number);if (Sum & 1)ans += P;P <<= 1;}return ans;
}int main()
{//freopen("input.txt", "r", stdin);return 0;
}
等差数列连续异或模板相关推荐
- sdnu1385.Problem A: XOR(连续异或规律)
Description Problem A: XOR Given two integers S and F, what is the XOR (exclusive-or) of all numbers ...
- PHP如何把三张图片均匀分布,C++ uniform_real_distribution连续均匀分布类模板用法详解...
uniform_real_distribution 类模板定义了一个默认返回 double 型浮点值的连续分布.可以按如下方式生成一个返回值在范围 [0,10) 内的分布对象: std::unifor ...
- ACM比赛经验、刷题记录及模板库总结(更新中)
前言 本文所提及的部分题目代码,可以在我的Github上找到 第一部分 经验分享及感受 第二部分 刷题记录 一.基础算法&程序语言 //strlen()函数的复杂度是O(n)要小心 //截取字 ...
- Python实现字符串与指定密钥循环异或加解密
异或运算在很多密码学算法中都有不同程度的应用,其运算特定在于一个数和另一个数连续异或两次仍得到原来的数.在实际使用中,因为要加密的信息和所使用的密钥在大多数情况下是不等长的,所以经常需要循环使用密钥. ...
- C++11 函数模板的默认模板参数
1.函数模板默认模板参数简介 函数模板与类模板在 C++98 一起被引入,因种种原因,类模板可以拥有默认模板参数,而函数模板不可以.从 C++11 开始,这个限制被解除了,即函数模板同样可以拥有默认模 ...
- ominigraffle 模板_商河盖梁模板安装
商河盖梁模板安装 e7k4h0c 商河盖梁模板安装 防止办法是:梁.板钢模板应通过设计确定龙骨.支柱的尺寸及间距,使钢模板支撑系统有足够的强度及刚度,防止浇混凝土时钢模板变形. 墩身墩柱桥梁模板的施工 ...
- 100个白球100个黑球,取出两个球,同色则补充黑色,异色则补充白色。最后剩什么颜色
[题目描述] 桶中取黑白球 有一个桶,里面有白球.黑球各100个,人们必须按照以下规则把球取出来: 1.每次从桶中那两个球 2.如果是两个同色的球,那就再放入一个黑球 3.如果是两个异色的球,那就再放 ...
- 1951. 宇宙人浇花(最大异或对变形)
https://citel.bjtu.edu.cn/acm/problem/1951#submit 宇宙人浇花 时间限制 1000 ms 内存限制 256 MB 因为没见过飞船,则卷博士把宇宙人的 ...
- 前缀异或:XOR Segment (用的是前缀和的思想,所以暂且称这个方法为前缀异或)
XOR Segment Time Limit : 3000/1000ms (Java/Other) Memory Limit : 65535/32768K (Java/Other) Total S ...
最新文章
- python random 随机生成一个数
- 使用CSS将文字长度限制为n行
- Lotus Notes应用经验谈
- b g opencv读入的图片 r_OpenCV提取显示一张图片(或者视频)的R,G,B颜色分量
- linux优化pdf,linux系统安全和优化.pdf
- android 按钮顶级效果_Android 源码之button高亮效果
- python和matlab的区别_我为什么选择Python,不是Matlab和R语言呢?
- 17届互联网校招薪酬报告:白菜价22W,青菜价30W,神价150W
- java-Servlet编码/异常处理
- PCB和PCBA设计及标准
- Excel如何根据身份证号码提取出性别
- TiDB集群的GC不回收案例(案情二)
- 姓舒男孩名字简单大气
- Python实现Reed-Xiaoli(RX)高光谱目标检测算法
- 关于显示器显示效果的调节(色温,6轴)
- PHP地图规划骑行路径,规划结果 + 骑行路线绘制
- ESP-MESH 无线组网,让智能家居通信更方便 | ESP32轻松学(Arduino版)
- 【浅墨Unity3D Shader编程】之一 夏威夷篇:游戏场景的创建 第一个Shader的书写
- android手机如何设置提高网速,安卓手机网速慢怎么办 安卓手机网速慢解决办法【详解】...
- WXGA TFT和XGA TFT的区别
热门文章
- Python破解验证码技术,识别率高达百分之八十
- 硬件重要还是软件重要?一个人能同时学会吗?
- c语言比较四个数大小并由小到大排序,c语言任意输入5个数,并按从大到小顺序输出...
- c语言进位程序,c语言中如何做带进位位移
- 单步调试_keil for arm 调试时无法单步运行及打断点
- 原生js ajax请求 post,原生js实现ajax 发送post请求
- 2020牛客多校第3场:Two Matchings[找规律+dp]
- python 小数点精度_Python 3浮点小数点/精度 - python
- 山西对口升学计算机分数线,2020年山西对口升学本科一批录取分数线是多少
- 计算机中的数制和编码教案,计算机《数制与编码进制转换》公开课教案.doc