HDU 5536 Chip Factory
来源:互联网 发布:淘宝店铺神笔在哪里 编辑:程序博客网 时间:2024/05/18 02:21
Chip Factory
Time Limit: 18000/9000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 4023 Accepted Submission(s): 1782
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 s_i.
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:
\max_{i,j,k} (s_i+s_j) \oplus s_k
which i,j,k are three different integers between 1 and n. And \oplus is symbol of bitwise XOR.
Can you help John calculate the checksum number of today?
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:
\max_{i,j,k} (s_i+s_j) \oplus s_k
which i,j,k are three different integers between 1 and n. And \oplus 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 s_1, s_2, .., s_n, separated with single space, indicating serial number of each chip.
1 \le T \le 1000
3 \le n \le 1000
0 \le s_i \le 10^9
There are at most 10 testcases with n > 100
The first line of each test case is an integer n, indicating the number of chips produced today. The next line has n integers s_1, s_2, .., s_n, separated with single space, indicating serial number of each chip.
1 \le T \le 1000
3 \le n \le 1000
0 \le s_i \le 10^9
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
231 2 33100 200 300
Sample Output
6400
Source
2015ACM/ICPC亚洲区长春站-重现赛(感谢东北师大)
Recommend
hujie
题目大意:给你一堆数字,选出三个数求出上面的公式的最大值
暴力可过,不知道为什么把它放在字典树里面,听说是用01字典树,暂时不会,先码住
暴力:
#include<iostream>using namespace std;const int maxn=1010;int a[maxn];int main(){int test;scanf("%d",&test);while(test--){int n;scanf("%d",&n);for(int i=0;i<n;i++) scanf("%d",&a[i]);int ans=-1;for(int i=0;i<n;i++){for(int j=i+1;j<n;j++){for(int k=j+1;k<n;k++){ans=max(ans,(a[i]+a[j])^a[k]);ans=max(ans,(a[i]+a[k])^a[j]);ans=max(ans,(a[j]+a[k])^a[i]);}}}printf("%d\n",ans);}}
阅读全文
0 0
- hdu 5536 Chip Factory
- HDU 5536 Chip Factory
- 【HDU】 5536 Chip Factory
- HDU 5536 Chip Factory
- hdu 5536 Chip Factory (暴力)
- hdu 5536 Chip Factory 字典树
- HDU 5536 Chip Factory 01字典树
- HDU-5536 Chip Factory(字典树)
- Chip Factory(HDU 5536 纯暴力)
- hdu 5536 Chip Factory 01 Trie
- HDU 5536 Chip Factory (01Trie)
- HDU 5536 Chip Factory (字典树)
- HDU 5536 Chip Factory(01字典树)
- HDU 5536 Chip Factory (枚举+01Trie)
- 01trie树 HDU 5536Chip Factory
- hdu 5536 Chip Factory(字典树)
- HDU 5536 Chip Factory 01trie
- HDU 5536 Chip Factory 【01字典树】
- Spring学习笔记之泛型依赖注入
- Oracle 事物
- WordPress上传文件大小限制修改
- matlab函数】conv2、filter2、imfilter的区别
- python_dict
- HDU 5536 Chip Factory
- Apache和Nginx优缺点对比
- java日常学习:多态
- python3 mysql
- 杭电acm用Java一直不通过
- 入阵曲(luogu3941)
- opencv实现中值滤波器
- 机动车驾驶培训学校驾校类完整网站织梦模板(带手机端)
- 画圆