zoukankan      html  css  js  c++  java
  • hdu3544找规律

    如果x>1&&y>1,可以简化到其中一个为1的情况,这是等价的,当其中一个为1(假设为x),另一个一定能执行y-1次,

    这是一个贪心问题,把所有的执行次数加起来比较就能得到结论

    #include<map>
    #include<set>
    #include<cmath>
    #include<queue>
    #include<stack>
    #include<vector>
    #include<cstdio>
    #include<cassert>
    #include<iomanip>
    #include<cstdlib>
    #include<cstring>
    #include<iostream>
    #include<algorithm>
    #define pi acos(-1)
    #define ll long long
    #define mod 1000000007
    #define ls l,m,rt<<1
    #define rs m+1,r,rt<<1|1
    #pragma comment(linker, "/STACK:1024000000,1024000000")
    
    using namespace std;
    
    const double g=10.0,eps=1e-9;
    const int N=100+10,maxn=1234567,inf=11111;
    
    int main()
    {
        ios::sync_with_stdio(false);
        cin.tie(0);
        int t,n,cnt=0;
        cin>>t;
        while(t--){
            cin>>n;
            ll c1=0,c2=0;
            for(int i=0;i<n;i++)
            {
                ll x,y;
                cin>>x>>y;
                while(x>1&&y>1){
                    x/=2;y/=2;
                }
                if(x==1)c2+=(y-1);
                else c1+=(x-1);
            }
            if(c1<=c2)cout<<"Case "<<++cnt<<": Bob"<<endl;
            else cout<<"Case "<<++cnt<<": Alice"<<endl;
        }
        return 0;
    }
    View Code
  • 相关阅读:
    一般图最大匹配
    UOJ164 线段树历史最值查询
    一个经典的排列组合面试题目
    动态代理理解
    JAVA nio
    hadoop NameNode 实现分析
    以一个上传文件的例子来说 DistributedFileSystem
    hadoop IPC 源代码分析
    hadoop DataNode实现分析
    HDFS 整体把握
  • 原文地址:https://www.cnblogs.com/acjiumeng/p/7069165.html
Copyright © 2011-2022 走看看