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 ...
随机推荐
- 理解JS表达式
表达式:是由运算元和运算符(可选)构成,并产生运算结果的语法结构. 基本表达式 以下在ES5中被称为基本表达式(Primary Expression) this.null.arguments等内置的关 ...
- 移动端meta标签的使用和设置
<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale= ...
- 04_ActiveMQ事务与三种签收方式
[ActiveMQ添加事务] 添加事务主要注意两点: 1.修改Session配置,启用事务 /** * 3.通过Connection对象创建Session会话(上下文环境对象),用于接收消息. * 参 ...
- 【Udacity笔记】What is Machine Learning?
Teaching computers to learn to perform tasks from past experiences(recorded data) 一.Decision Tree(决策 ...
- 微信小程序——初始化一个小程序项目
最近准备学习一下微信小程序,因为之前有react native项目经验,学习起来应该困难不大 微信小程序官网地址:https://mp.weixin.qq.com/debug/wxadoc/dev/i ...
- NgModelController: $setViewValue,$render,Formatter, Parser
NgModelController为ngModel directive提供了API.这个controller包含了关于data-binding,validation,css update, value ...
- CentOS: 将虚拟机迁移到 Azure (以阿里云为例)
Azure 虚拟机能很容易地导出 vhd 并迁移到各种环境中,包含本地及云端环境,或者迁移至其他区域.这为开发.测试.扩展带来了极大的便利.因此本文以阿里云为例,阐述的是如何将 CentOS 6.8 ...
- CefSharp开发
CefSharp是用chromium内核开发的.net版本浏览器工具.目前只支持X86模式.所以在调试的时候要把平台改为X86 CefSharp开发指引:https://ourcodeworld.co ...
- Threading in C# 5
Part 5: Parallel Programming In this section, we cover the multithreading APIs new to Framework 4.0 ...
- 关于LDA的文章
转:http://www.zhizhihu.com/html/y2011/3228.html l Theory n Introduction u Unsupervised learning by ...