网上找的模板,还不太懂,改了下,先留着
#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)
#endif
typedef 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;
else
return 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;
}
分享到:
相关推荐
异或校验工具。十六进制异或值计算。。。。。。。。。。
CRC计算器工具,有和、异或、异或取反等校验方法计算,方便前期应用开发
CString 按位异或 CString 按位异或 CString 按位异或
crc 异或校验 c语言 方便移植
简单的异或加密,一个小例子,异或加密,需要的朋友,可以自己下载,希望对你有帮助。
异或计算器,可以执行同时执行和校验与8位异或校验
求异或值的软件
异或校验.rar
用qt实现的异或计算工具(带源码),16进制输入按字节进行异或,带输入错误提示。
异或加解密工具
用labview写的,用于字符串ascii码异或和校验,文件中转有dll库 可以到http://www.ip33.com/bcc.html这个网址验证是否正确
vc 异或圆 程序代码, 主要用于程序上的异或圆操作.
目前在做和GPS通讯协议相关的项目项目中有用到异或和校验的部分就自己写了小工具包含源码给需要的朋友。 输入内容为 16进制字符串 输出也是16进制的字符串
最简单的进行两图像的加减和异或,同或,运算。
异或求和方法 在底层串口开发,或者网络通信开发中经常会用到十六进制验证码计算等方法。
简单的异或计算工具,在通讯或其他时候可以用得上
异或校验算法工具,输出异或校验的结果。
这是使用异或实现的简单的文件的加解密,另外还有一个我的资源实现加解密的在这里:https://download.csdn.net/download/lxiao428/10802653
用于计算十六进制的异或运算,内含源文件以及执行文件