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

zoj 4057

时间:2018-09-18 11:21:06      阅读:124      评论:0      收藏:0      [点我收藏+]

标签:\n   fine   cst   --   return   class   turn   bsp   ace   

 

 

技术分享图片

 

 

技术分享图片

 

 

 

 

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <string>
#include <cmath>
using  namespace std;
#define ll long long
const int N =1e5+9;
int t,n,a[N];
int b[50];
/*
要想两个数的异或结果比两者都大
必须两数的首位都为1,其他位不行
*/
int main()
{
    scanf("%d",&t);
    while(t--)
    {
        scanf("%d",&n);
        for(int i=0;i<50;i++) b[i]=0;
        for(int i=1;i<=n;i++)
        {
            scanf("%d",&a[i]);
        }
        int maxx=0;
        for(int i=1;i<=n;i++)
        {
            for(int j=30;j>=0;j--)
            {
                if(a[i]>>j&1) {
                    b[j]++;
                    maxx=max(maxx,b[j]);
                    break;
                }
            }
        }
        printf("%d\n",maxx);
    }
    return 0;
}

 

zoj 4057

标签:\n   fine   cst   --   return   class   turn   bsp   ace   

原文地址:https://www.cnblogs.com/tingtin/p/9667142.html

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