HDU 5536--Chip Factory(暴力)
Chip Factory
Time Limit: 18000/9000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others)
Total Submission(s): 5394 Accepted Submission(s): 2422
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:
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?
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
3
1 2 3
3
100 200 300
400
#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(暴力)的更多相关文章
- HDU 5536 Chip Factory (暴力+01字典树)
<题目链接> 题目大意: 给定一个数字序列,让你从中找出三个不同的数,从而求出:$\max_{i,j,k} (s_i+s_j) \oplus s_k$的值. 解题分析:先建好01字典树,然 ...
- HDU 5536 Chip Factory 字典树+贪心
给你n个数,a1....an,求(ai+aj)^ak最大的值,i不等于j不等于k 思路:先建字典树,暴力i,j每次删除他们,然后贪心找k,再恢复i,j,每次和答案取较大的,就是答案,有关异或的貌似很多 ...
- HDU 5536 Chip Factory 【01字典树删除】
题目传送门:http://acm.hdu.edu.cn/showproblem.php?pid=5536 Chip Factory Time Limit: 18000/9000 MS (Java/Ot ...
- HDU 5536 Chip Factory 字典树
Chip Factory Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pid= ...
- hdu 5536 Chip Factory (01 Trie)
链接:http://acm.hdu.edu.cn/showproblem.php?pid=5536 题面; Chip Factory Time Limit: 18000/9000 MS (Java/O ...
- 2015ACM/ICPC亚洲区长春站 J hdu 5536 Chip Factory
Chip Factory Time Limit: 18000/9000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others)T ...
- HDU 5536 Chip Factory
Chip Factory Time Limit: 18000/9000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others)T ...
- hdu 5536 Chip Factory 字典树+bitset 铜牌题
Chip Factory Time Limit: 18000/9000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others)T ...
- ACM学习历程—HDU 5536 Chip Factory(xor && 字典树)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5536 题目大意是给了一个序列,求(si+sj)^sk的最大值. 首先n有1000,暴力理论上是不行的. ...
- HDU 5536 Chip Factory Trie
题意: 给出\(n(3 \leq n \leq 1000)\)个数字,求\(max(s_i+s_j) \bigoplus s_k\),而且\(i,j,k\)互不相等. 分析: 把每个数字看成一个\(0 ...
随机推荐
- ASP.NET内容页中访问母版页中的对象
在ASP.NET2.0开始,提供了母版页的功能.母版页由一个母版页和多个内容页构成.母版页的主要功能是为ASP.NET应用程序中的页面创建相同的布局和界面风格.母版页的使用与普通页面类似,可以在其中放 ...
- ArcSDE 常用命令
一.sdeservice命令: 1. 创建sde服务:sdeservice –o create ArcSDE常用操作命令(转): 启动cmd 1. 创建和删除ArcSDE服务操作命令(sdeservi ...
- asp.net怎么让某一页的 requestEncoding设置成utf-8
web.config里是这样的 <globalization requestEncoding="gb2312" responseEncoding="gb2312&q ...
- 【阿里云产品公测】在ACE上部署WP测试体验
ACE服务其实已经有很多类似的服务提供商了,无论收费的还是免费的, 但是到现在为止还没有体验过,正好借着这次机会,来体验一下阿里云的ACE服务. ' !2NSv /IQ$[WR cx B ...
- SharePoint 2013 - REST API about Security
1. 获取当前用户信息(current user): var currentUserInfo = "{0}/_api/Web/CurrentUser"; // {0} -> ...
- 学习C++从入门到精通的的十本最经典书籍
原文:http://blog.csdn.net/a_302/article/details/17558369 最近想学C++,找了一下网上推荐的书籍,转载过来给大家分享 转载自http://c.chi ...
- Jmeter CSV 参数化/检查点/断言
当参数的值没有规律且量不太大时,可以使用CSV Data set config这种方法. 案例: 应用Sogou自动搜索关键字: 软件开发测试,web功能自动化测试,性能自动化测试,Selenium以 ...
- delphi 获取可执行文件的当前路径
在Delphi SysUtils 单元中有 ExtractFileDir 与 ExtractFilePath两个类似的函数, 两个函数有以下的区别: ExtractFilePath 传回值的最後一个字 ...
- Data truncation: Out of range value for column 'id' at row 1 ### The
org.springframework.dao.DataIntegrityViolationException: ### Error updating database. Cause: com.mys ...
- Oracle基础之Merge into
Merge into语句是Oracle9i新增的语法,用来合并UPDATE和INSERT语句. 通过MERGE语句,根据一张表或多表联合查询的连接条件对另外一张表进行查询,连接条件匹配上的进行UPDA ...