码迷,mamicode.com
首页 > 其他好文 > 详细

ZVRK函数

时间:2018-10-04 14:30:55      阅读:141      评论:0      收藏:0      [点我收藏+]

标签:alt   ++   src   ret   inf   open   long   +=   using   

题面:

技术分享图片

思路:

 

代码:

#include<bits/stdc++.h>
using namespace std;
long long l,r,ans,x=1,n,f;
int main(){
    freopen("zvrk.in","r",stdin);
    freopen("zvrk.out","w",stdout);
    scanf("%lld%lld",&l,&r);
    l--;
    while(l){
        f=l&1;
        l>>=1;
        ans-=x*(l+f);
        x<<=1;
    }
    x=1;
    while(r){
        f=r&1;
        r>>=1;
        ans+=x*(r+f);
        x<<=1;
    }
    printf("%lld",ans);
    return 0;
}

 

ZVRK函数

标签:alt   ++   src   ret   inf   open   long   +=   using   

原文地址:https://www.cnblogs.com/godrose/p/9742154.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!