• 等差数列连续异或模板


    网上找的模板,还不太懂,改了下,先留着

    #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)
    #define WS(n) printf("%s
    ", 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;
    }
    


  • 相关阅读:
    ActionBarSherlock的使用--------(一)配置
    宣布发布 Windows Azure ExpressRoute,宣告与 Level 3 建立全新的合作伙伴关系并推出关于其他 Azure 服务令人振奋的更新
    最佳实践:Windows Azure 网站 (WAWS)
    Strata 2014 上的 AzureCAT 粉笔会谈
    Windows Azure HDInsight 支持预览版 Hadoop 2.2 群集
    Windows Azure 网站上的 WordPress 3.8
    进一步探索:Windows Azure 网站中解锁的配置选项
    如何使用 Barracuda 防火墙设置/保护 Azure 应用程序
    Windows Azure 网站自愈
    宣布与 NBC 合作直播索契冬季奥运
  • 原文地址:https://www.cnblogs.com/suncoolcat/p/3395472.html
Copyright © 2020-2023  润新知