Problem Description

You are given a sequence of NNN integers.

You should choose some numbers(at least one),and make the product of them as big as possible.

It guaranteed that the absolute value of any product of the numbers you choose in the initial sequence will not bigger than 263−12^{63}-12​63​​−1.

Input

In the first line there is a number TTT (test numbers).

For each test,in the first line there is a number NNN,and in the next line there are NNN numbers.

1≤T≤10001 \leq T \leq 10001≤T≤1000 1≤N≤621 \leq N \leq 621≤N≤62

You'd better print the enter in the last line when you hack others.

You'd better not print space in the last of each line when you hack others.

Output

For each test case,output the answer.

Sample Input
1
3
1 2 3
Sample Output
6

23333这道题大数据没过。水题判断下正负/减掉0/乘起来即可,想再试下unsign LL感觉有戏,原代码贴上
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<iostream>
using namespace std;
long long a,b,c,t;
int d,e=,f,i,j;
int main()
{
freopen("stdin.txt","r",stdin);
scanf("%d",&f);
while(f!=)
{
f--;
e=d=b=;
t=;
scanf("%d",&d);
for(j=;j<=d;j++)
{
scanf("%I64d",&b);
if(b==) continue;
t*=b;
e=;
}
if(t<) t=-t;
if(e==) {cout<<"0\n";continue;}
cout<<t<<endl;
}
return ;
}

BestCoder Round #60 1001的更多相关文章

  1. 贪心 BestCoder Round #39 1001 Delete

    题目传送门 /* 贪心水题:找出出现次数>1的次数和res,如果要减去的比res小,那么总的不同的数字tot不会少: 否则再在tot里减去多余的即为答案 用set容器也可以做,思路一样 */ # ...

  2. 暴力 BestCoder Round #41 1001 ZCC loves straight flush

    题目传送门 /* m数组记录出现的花色和数值,按照数值每5个搜索,看看有几个已满足,剩下 5 - cnt需要替换 ╰· */ #include <cstdio> #include < ...

  3. 暴力 BestCoder Round #46 1001 YJC tricks time

    题目传送门 /* 暴力:模拟枚举每一个时间的度数 详细解释:http://blog.csdn.net/enjoying_science/article/details/46759085 期末考结束第一 ...

  4. 字符串处理 BestCoder Round #43 1001 pog loves szh I

    题目传送门 /* 字符串处理:是一道水题,但是WA了3次,要注意是没有加'\0'的字符串不要用%s输出,否则在多组测试时输出多余的字符 */ #include <cstdio> #incl ...

  5. BestCoder Round #75 1001 - King's Cake

    Problem Description It is the king's birthday before the military parade . The ministers prepared a ...

  6. BestCoder Round #92 1001 Skip the Class —— 字典树 or map容器

    题目链接:http://bestcoder.hdu.edu.cn/contests/contest_showproblem.php?cid=748&pid=1001 题解: 1.trie树 关 ...

  7. BestCoder Round #60 题解链接

    题解  题目 1001 GT and sequence 注意先特判000的情况:如果读入的数据有000,那么去掉所有的000且最后答案和000取一个max. 剩下的正数显然全部乘起来比较优. 对于负数 ...

  8. BestCoder Round #2 1001 (简单处理)

    题目链接 题意:给N条信息,每个信息代表有x个人从开始的时间 到 结束的时间在餐厅就餐, 问最少需要多少座位才能满足需要. 分析:由于时间只有24*60 所以把每个时间点放到 数组a中,并标记开始的时 ...

  9. HDU 5506 - BestCoder Round #60 - GT and set

    题目链接 : http://bestcoder.hdu.edu.cn/contests/contest_chineseproblem.php?cid=641&pid=1003 题意 : 给N集 ...

随机推荐

  1. LINUX下软件包的安装与使用

    1.安装RPM包 rpm -ivh 包全名 2.查询某个包是否安装 rpm -q 包名 3.查询已安装的包的信息(主要看版本) rpm -qi 包名 4.查询已安装包的安装位置 rpm -ql 包名 ...

  2. Bootstrap3.0学习第十八轮(JavaScript插件——下拉菜单)

    详情请查看 http://aehyok.com/Blog/Detail/25.html 个人网站地址:aehyok.com QQ 技术群号:206058845,验证码为:aehyok 本文文章链接:h ...

  3. NABCD——竞争性需求分析的框架

    最近在读邹欣老师的书<构建之法>,读到很多地方,相当有感触,有种一拍大腿“啊,他说的太对了”的感觉,但都疏于记录,今天又看到一个一拍大腿特带感的一节,决定记录下来. 竞争性需求分析的框架— ...

  4. css知识点补充、css属性、

    1.媒体查询的css代码的优先级要比其他的高! 2.text-overflow: 定义文本溢出父级元素如何处理!    clip/ellipsis/string 3.overflow: visible ...

  5. iOS开发小技巧--利用运行时得到隐藏的成员变量

    一.关于运行时,已经从网络上摘抄了一片文章,这里只有项目中自己的简单使用 -- 查找隐藏的成员变量 导入头文件 可以获得隐藏的成员变量,方法,属性等 代码: 打印效果图:

  6. xml文件的读写操作

    1.直接上代码:包含了xml文档的创建,读取xml文档,创建根节点,向根节点中添加子节点,保存xml文档----------先来张效果图: static void Main(string[] args ...

  7. c语言的数学函数ceil、floor、round

    头文件<math.h> 函数原型和作用 double ceil(double x); 向上取整 double floor(double x); 向下取整 double round(doub ...

  8. Struts2的使用以及Spring整合Struts2

    一.如何单独使用Struts2 (1)引入struts2的jar包 commons-fileupload-1.2.1.jar freemarker-2.3.15.jar ognl-2.7.3.jar ...

  9. asp.net 实现在线打印功能,jQuery打印插件PrintArea实现自动分页

    使用的组件:jQuery打印插件PrintArea,有兴趣的可以研究一下. 使用方法略过,这里将介绍如何实现打印多页是可以分页. 现在提供两种方法思路: 1.根据特定的打印机型号和使用的纸张类型,然后 ...

  10. ci中如何私有化方法

    私有方法 在某些情况下,你可能想要隐藏一些方法使之无法对外查阅.将方法私有化很简单,只要在方法名字前面加一个下划线("_")做前缀就无法通过 URL 访问到了.例如,如果你有一个像 ...