zoukankan      html  css  js  c++  java
  • 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)*/

    保持热爱 不懈努力 不试试看怎么知道会失败呢(划掉) 世上无难事 只要肯放弃(划掉)
  • 相关阅读:
    Spring Boot
    Spring Boot
    Spring Boot
    Restful API
    Jenkins
    虚拟化
    SpringBoot入门
    System Workbench for STM32(based on Eclipse)开发环境配置
    装机总结
    这年暑假
  • 原文地址:https://www.cnblogs.com/ldudxy/p/10508087.html
Copyright © 2011-2022 走看看