等差数列连续异或模板
网上找的模板,还不太懂,改了下,先留着
#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;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;}