Chip Factory

Time Limit: 18000/9000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others)
Total Submission(s): 5394    Accepted Submission(s): 2422

Problem Description
John is a manager of a CPU chip factory, the factory produces lots of chips everyday. To manage large amounts of products, every processor has a serial number. More specifically, the factory produces n chips today, the i-th chip produced this day has a serial number si.
At the end of the day, he packages all the chips produced this day, and send it to wholesalers. More specially, he writes a checksum number on the package, this checksum is defined as below:

maxi,j,k(si+sj)⊕sk

which i,j,k are three different integers between 1 and n. And ⊕ is symbol of bitwise XOR.
Can you help John calculate the checksum number of today?

 
Input
The first line of input contains an integer T indicating the total number of test cases.

The first line of each test case is an integer n, indicating the number of chips produced today. The next line has n integers s1,s2,..,sn, separated with single space, indicating serial number of each chip.

1≤T≤1000
3≤n≤1000
0≤si≤109
There are at most 10 testcases with n>100

 
Output
For each test case, please output an integer indicating the checksum number in a line.
 
Sample Input
2
3
1 2 3
3
100 200 300
 
Sample Output
6
400
 
Source
 
时间充裕,暴力一发0.0
 
 #include <iostream>
#include<cstring>
#include<algorithm>
#include<cstdio>
#include<cmath>
using namespace std;
int a[];
int main()
{
int t;
scanf("%d",&t);
while(t--)
{
int n,m=-;
scanf("%d",&n);
for(int i=;i<n;i++)
scanf("%d",&a[i]);
for(int i=;i<n;i++){
for(int j=i+;j<n;j++){
for(int k=j+;k<n;k++){
m=max(m,(a[i]+a[j])^a[k]);
m=max(m,(a[j]+a[k])^a[i]);
m=max(m,(a[i]+a[k])^a[j]);
}
}
}
printf("%d\n",m);
}
return ;
}
 

HDU 5536--Chip Factory(暴力)的更多相关文章

  1. HDU 5536 Chip Factory (暴力+01字典树)

    <题目链接> 题目大意: 给定一个数字序列,让你从中找出三个不同的数,从而求出:$\max_{i,j,k} (s_i+s_j) \oplus s_k$的值. 解题分析:先建好01字典树,然 ...

  2. HDU 5536 Chip Factory 字典树+贪心

    给你n个数,a1....an,求(ai+aj)^ak最大的值,i不等于j不等于k 思路:先建字典树,暴力i,j每次删除他们,然后贪心找k,再恢复i,j,每次和答案取较大的,就是答案,有关异或的貌似很多 ...

  3. HDU 5536 Chip Factory 【01字典树删除】

    题目传送门:http://acm.hdu.edu.cn/showproblem.php?pid=5536 Chip Factory Time Limit: 18000/9000 MS (Java/Ot ...

  4. HDU 5536 Chip Factory 字典树

    Chip Factory Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pid= ...

  5. hdu 5536 Chip Factory (01 Trie)

    链接:http://acm.hdu.edu.cn/showproblem.php?pid=5536 题面; Chip Factory Time Limit: 18000/9000 MS (Java/O ...

  6. 2015ACM/ICPC亚洲区长春站 J hdu 5536 Chip Factory

    Chip Factory Time Limit: 18000/9000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others)T ...

  7. HDU 5536 Chip Factory

    Chip Factory Time Limit: 18000/9000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others)T ...

  8. hdu 5536 Chip Factory 字典树+bitset 铜牌题

    Chip Factory Time Limit: 18000/9000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others)T ...

  9. ACM学习历程—HDU 5536 Chip Factory(xor && 字典树)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5536 题目大意是给了一个序列,求(si+sj)^sk的最大值. 首先n有1000,暴力理论上是不行的. ...

  10. HDU 5536 Chip Factory Trie

    题意: 给出\(n(3 \leq n \leq 1000)\)个数字,求\(max(s_i+s_j) \bigoplus s_k\),而且\(i,j,k\)互不相等. 分析: 把每个数字看成一个\(0 ...

随机推荐

  1. Storm Flow

    A Stream represents the core data model in Trident, and can be thought of as a "stream" of ...

  2. Android 最新 Support V4 包大拆分有用吗?

    Google 更新了最新的 Support Library 版本,其中最为显眼的功能莫过于 support-v4 大拆分,然后这个拆分现在看来并没有那么美好. v4 包从 2011 年开始引入,包含 ...

  3. Appium 常用方法

    锁定 锁定屏幕 # python driver.lock(5) 将 app 置于后台 把当前应用放到后台去 # python driver.background_app(5) 收起键盘 收起键盘 # ...

  4. CSS media query应用中的层叠特性使用最佳实践

    media query是css3规范中引入的,它提供了一种responsive design的基础机制:浏览器在不同size的设备中将以不同样式展现网页,这就给一个网页能够适应不同device一种可能 ...

  5. Windows下sc create命令行添加/创建/修改服务

    添加服务: sc create TestService binpath= "D:\TestApp\TestService.exe" 注意:所有的等号和值之间需要一个空格(等号前不要 ...

  6. SQL Server ->> SQL Server 2016新特性之 -- AlwaysOn的增强改进

    1)标准版也开始支持AlwaysOn了,只不过限制太多,比如副节点不能只读访问和只能有一个副节点. 2)副节点(只读节点)的负载均衡,这是我认为最有用的改进 3)自动failover的节点从2个增加到 ...

  7. AppDomain配置和卸载

    AppDomain 1.配置AppDomain 使用AppDomainSetup类为新应用程序域提供带有配置信息的公共语言运行时.创建自己的应用程序域时,最重要的ApplicationBase(它是定 ...

  8. .C#认证考试试题汇编:第一单元:1,11 第二单元:1,11

    第一单元1,11 好久没用异或都快忘了,就让我们一起来了解哈啥子事异或 说的这个,就不经意让我想起书上的几种交换值得方法了 我这儿说的交换的方法是,不使用第三个变量来交换,而是两个 实现条件是C a= ...

  9. background-color和background-image相关细节

    1.background-color 是以border-box作为他的左上角来定位的 2.background-image 默认是以padding-box作为他的左上角来定位的 3.backgroun ...

  10. vbox安装 ubuntu server 后 安装增强包

    用vbox安装虚拟机系统如果不装增强包, 有很多东西就有点不好用-用vbox安装ubuntu server时,点击菜单中的安装增强功能.因为ubuntu server版本没有ui,所以不能很方便滴找到 ...