hdu-5680 zxa and set(水题)
题目链接:
Time Limit: 2000/1000 MS (Java/Others)
Memory Limit: 65536/65536 K (Java/Others)
For each subset B={b1,b2,⋯,bm}(1≤m≤n) of A, which has m elements, zxa defined its value as min(b1,b2,⋯,bm).
zxa is interested to know, assuming that Sodd represents the sum of the values of the non-empty sets, in which each set B is a subset of A and the number of elements in B is odd, and Seven represents the sum of the values of the non-empty sets, in which each set B is a subset of A and the number of elements in B is even, then what is the value of |Sodd−Seven|, can you help him?
For each test case:
The first line contains an positive integer n, represents the number of the set A is n.
The second line contains n distinct positive integers, repersent the elements a1,a2,⋯,an.
There is a blank between each integer with no other extra space in one line.
1≤T≤100,1≤n≤30,1≤ai≤10^9
//#include <bits/stdc++.h>
#include <iostream>
#include <queue>
#include <cmath>
#include <map>
#include <cstring>
#include <algorithm>
#include <cstdio>
using namespace std;
#define Riep(n) for(int i=1;i<=n;i++)
#define Riop(n) for(int i=0;i<n;i++)
#define Rjep(n) for(int j=1;j<=n;j++)
#define Rjop(n) for(int j=0;j<n;j++)
#define mst(ss,b) memset(ss,b,sizeof(ss));
typedef long long LL;
const LL mod=1e9+;
const double PI=acos(-1.0);
const int inf=0x3f3f3f3f;
const int N=1e5+;
int n,a[];
int main()
{
int t;
scanf("%d",&t);
while(t--)
{
scanf("%d",&n);
Riep(n)scanf("%d",&a[i]);
sort(a+,a+n+);
printf("%d\n",a[n]);
} return ;
}
hdu-5680 zxa and set(水题)的更多相关文章
- HDU 5578 Friendship of Frog 水题
Friendship of Frog Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.ph ...
- HDU 5590 ZYB's Biology 水题
ZYB's Biology Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pid ...
- HDU 5538 L - House Building 水题
L - House Building Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.ph ...
- hdu 1005:Number Sequence(水题)
Number Sequence Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)T ...
- hdu 1018:Big Number(水题)
Big Number Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total ...
- hdu 2041:超级楼梯(水题,递归)
超级楼梯 Time Limit: / MS (Java/Others) Memory Limit: / K (Java/Others) Total Submission(s): Accepted Su ...
- HDOJ/HDU 1328 IBM Minus One(水题一个,试试手)
Problem Description You may have heard of the book '2001 - A Space Odyssey' by Arthur C. Clarke, or ...
- HDOJ(HDU) 2090 算菜价(简单水题、)
Problem Description 妈妈每天都要出去买菜,但是回来后,兜里的钱也懒得数一数,到底花了多少钱真是一笔糊涂帐.现在好了,作为好儿子(女儿)的你可以给她用程序算一下了,呵呵. Input ...
- HDOJ(HDU) 1555 How many days?(水题)
Problem Description 8600的手机每天消费1元,每消费K元就可以获赠1元,一开始8600有M元,问最多可以用多少天? Input 输入包括多个测试实例.每个测试实例包括2个整数M, ...
- hdu 2710 Max Factor 数学(水题)
本来是不打算贴这道水题的,自己却WA了三次.. 要考虑1的情况,1的质因子为1 思路:先打表 ,然后根据最大质因子更新结果 代码: #include<iostream> #include& ...
随机推荐
- .NET/C#- EPPLUS DEMO
强大的导出EXCEL,比NPOI更好用,更强大,可惜只有4.0版本的. 记录一下DEMO var sheet = p.Workbook.Worksheets.Add("My Sheet&qu ...
- d3d导致cairo不正常
最近要把cairo集成到项目中,却发现cairo不能工作了 折腾了两天才找到了原因:cairo的一个trick导致浮点数计算错误: http://blog.163.com/lvan100@yeah/b ...
- C:进制
进制.C语言内存分配 1.对于进制 10进制 (0 - 9)16进制 (0——9 A B C D E F)硬件中的高低电平(0 和 1表示)所以计算机用 二进制 机器语言就是由 0 和 1 组成的一 ...
- java中Arrays类中,binarySearch()方法的返回值问题
最近在复习Java知识,发现果然不经常使用忘得非常快... 看到binarySearch()方法的使用时,发现书上有点错误,于是就自己上机实验了一下,最后总结一下该方法的返回值. 总结:binaryS ...
- Eclipse中SVN的安装步骤(两种)和用法
一.给安装EclipseSVN,最常见的有两种方式:手动方式和使用安装向导方式.详细过程例如以下: 方式一:手动安装 1.从官网下载site-1.6.9.zip文件,网址是:subclipse.tig ...
- android-square-progressbar-legacy
https://github.com/eltld/android-square-progressbar-legacy
- <<SAP内存计算——HANA>> 书评
<SAP内存计算——HANA>又是一本在地铁里读完的书,最近阅读量大增,都是托了地铁的福了. 一年多以前就在ITPUB里发过帖子问“SAP HANA归根揭底到底是什么?”,那时通过一些网络 ...
- android调用系统相机拍照并保存在本地
import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import j ...
- 分布式存储系统sheepdog
Sheepdog,是由NTT的3名日本研究员开发的开源项目,主要用来为虚拟机提供块设备. 其架构例如以下: 以下,我们将从架构.模块等几个方面来介绍下: 一.架构图 如上图: 採用无中心节点的全对称架 ...
- cocos2d-x jsbinding 在线更新策略设计
在线更新是用脚本编写游戏逻辑的特有功能,由于脚本语言是边解释边编译的特性,使得游戏在运行的时候可以通过下载最新的脚本来执行游戏逻辑.在不修改Native接口的情况下,在线更新每次更新只需要下载一个(5 ...