zoj 4057


#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <string>
#include <cmath>
using namespace std;
#define ll long long
const int N =1e5+;
int t,n,a[N];
int b[];
/*
要想两个数的异或结果比两者都大
必须两数的首位都为1,其他位不行
*/
int main()
{
scanf("%d",&t);
while(t--)
{
scanf("%d",&n);
for(int i=;i<;i++) b[i]=;
for(int i=;i<=n;i++)
{
scanf("%d",&a[i]);
}
int maxx=;
for(int i=;i<=n;i++)
{
for(int j=;j>=;j--)
{
if(a[i]>>j&) {
b[j]++;
maxx=max(maxx,b[j]);
break;
}
}
}
printf("%d\n",maxx);
}
return ;
}
zoj 4057的更多相关文章
- ZOJ 4057 XOR Clique(位运算)
XOR Clique BaoBao has a sequence a1,a2,...,an. He would like to find a subset S of {1,2,...,n} s ...
- ZOJ People Counting
第十三届浙江省大学生程序设计竞赛 I 题, 一道模拟题. ZOJ 3944http://www.icpc.moe/onlinejudge/showProblem.do?problemCode=394 ...
- ZOJ 3686 A Simple Tree Problem
A Simple Tree Problem Time Limit: 3 Seconds Memory Limit: 65536 KB Given a rooted tree, each no ...
- ZOJ Problem Set - 1394 Polar Explorer
这道题目还是简单的,但是自己WA了好几次,总结下: 1.对输入的总结,加上上次ZOJ Problem Set - 1334 Basically Speaking ac代码及总结这道题目的总结 题目要求 ...
- ZOJ Problem Set - 1392 The Hardest Problem Ever
放了一个长长的暑假,可能是这辈子最后一个这么长的暑假了吧,呵呵...今天来实验室了,先找了zoj上面简单的题目练练手直接贴代码了,不解释,就是一道简单的密文转换问题: #include <std ...
- ZOJ Problem Set - 1049 I Think I Need a Houseboat
这道题目说白了是一道平面几何的数学问题,重在理解题目的意思: 题目说,弗雷德想买地盖房养老,但是土地每年会被密西西比河淹掉一部分,而且经调查是以半圆形的方式淹没的,每年淹没50平方英里,以初始水岸线为 ...
- ZOJ Problem Set - 1006 Do the Untwist
今天在ZOJ上做了道很简单的题目是关于加密解密问题的,此题的关键点就在于求余的逆运算: 比如假设都是正整数 A=(B-C)%D 则 B - C = D*n + A 其中 A < D 移项 B = ...
- ZOJ Problem Set - 1001 A + B Problem
ZOJ ACM题集,编译环境VC6.0 #include <stdio.h> int main() { int a,b; while(scanf("%d%d",& ...
- zoj 1788 Quad Trees
zoj 1788 先输入初始化MAP ,然后要根据MAP 建立一个四分树,自下而上建立,先建立完整的一棵树,然后根据四个相邻的格 值相同则进行合并,(这又是递归的伟大),逐次向上递归 四分树建立完后, ...
随机推荐
- pytorch 0.3 win7 安装
pytorch 0.3 win7 安装 参考这个文章:https://github.com/peterjc123/pytorch-scripts 首先安装 conda 这个链接下载: python 3 ...
- 【Java】 jar解压与压缩
jar解压与压缩 命令格式:jar {c t x u f }[ v m e 0 M i ][-C 目录]文件名 # 解压,到当前目录 jar -xvf source.jar # 打包,不进行压缩 ja ...
- mongodb集合的增删
1.创建集合 createCollection() 方法 MongoDB db.createCollection(name, options) 是用来创建集合. 语法: 基本的 createColle ...
- Objective-C Inheritance
One of the most important concepts in object-oriented programming is that of inheritance. Inheritanc ...
- 电话号码 马赛克*号 string类扩展
/// <summary> /// 字符串马赛克 /// </summary> /// <param name="source"></pa ...
- Python 时间戳和日期相互转换
转载地址:http://liyangliang.me/posts/2012/10/python-timestamp-to-timestr/ 在写Python的时候经常会遇到时间格式的问题,每次都是上 ...
- mysql-新增、更新、删除语句
1.插入数据: INSERT INTO t_book VALUES(NULL,'我爱我家',20,'张三',1); INSERT INTO t_book(id,bookName,price,autho ...
- [VC]ocx控件怎么屏蔽backspace的后退键
<script Language=javascript> function document.onkeydown() { if(window.event.keyCode = ...
- 2717: 递归函数求n的阶乘
2717: 递归函数求n的阶乘 Time Limit: 1 Sec Memory Limit: 128 MBSubmit: 1329 Solved: 942[Submit][Status][Web ...
- 剑指offer题目分类
1. 链表 1. 从尾到头打印链表 2. 链表中倒数第k个结点 3. 反转链表 4. 合并两个排序的链表 5. 复杂链表的复制 6. 复杂链表的复制 7. 两个链表的第一个公共结点 8. 链表中环的入 ...