zoukankan      html  css  js  c++  java
  • codeforce 611B New Year and Old Property

    暴力搞

    #include<cstdio>
    #include<cstring>
    #include<cmath>
    #include<algorithm>
    using namespace std;
    
    long long a,b;
    long long tmpa,tmpb;
    long long num1[70],num2[70];
    int tot1,tot2;
    
    
    int main()
    {
    //    freopen("F:\info.txt","w",stdout);
        scanf("%lld%lld",&a,&b);
        tmpa=a;
        tmpb=b;
        tot1=0;tot2=0;
        while(tmpa) num1[tot1++]=tmpa%2,tmpa=tmpa/2;
        while(tmpb) num2[tot2++]=tmpb%2,tmpb=tmpb/2;
    
        long long c=0;
    
        long long ans=0;
    
        for(int len=tot1;len<=tot2;len++)
        {
            for(int i=0;i<len-1;i++)
            {
                c=0;
                for(int j=0;j<len;j++)
                {
                    if(i==j) continue;
                    else c=c+(long long)pow(2.0,j);
                }
            //    printf("%lf
    ",c);
                
                if(c-a>=0&&b-c>=0) ans++;
            }
        }
        printf("%lld
    ",ans);
        return 0;
    }
  • 相关阅读:
    POJ 2689
    NEFU 109
    HDU 2098
    NEFU 2
    NEFU 117
    NEFU 84
    POJ 1061
    NEFU116 GCD
    NEFU 115
    HDU 2099
  • 原文地址:https://www.cnblogs.com/zufezzt/p/5094153.html
Copyright © 2011-2022 走看看