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. C语言总结(6)

    1.表达式: 算数表达式: 单目:+, -, ++, --. 双目:+,-,*,/,%. 赋值表达式: 简单赋值:= 复合赋值:+=,-=,*=,,/=%=,!=. 关系表达式: >,>= ...

  2. [转]DIV+CSS和TABLE的区别

    现在全国大大小小的网站都在搞一场技术“革命”,就是所谓“网站重构”说简单点就是DIV+CSS进行网站制作.用DIV+CSS代替传统的Table制作框架和美化页面.百度搜索优化 在重构之前,肯定要了解为 ...

  3. Java 缓存技术

    以下仅是对map对方式讨论.没有对点阵图阵讨论.作缓存要做以下2点:  1:清理及更新缓存时机的处理: . 虚拟机内存不足,清理缓存 .. 缓存时间超时,或访问次数超出, 启动线程更新 2:类和方法的 ...

  4. opencv笔记1:opencv的基本模块,以及环境搭建

    opencv笔记1:opencv的基本模块,以及环境搭建 安装系统 使用fedora22-workstation-x86_64 安装opencv sudo dnf install opencv-dev ...

  5. asp.net input怎么获取值

    前台: <input type="hidden" name="content" value="content"> 后台: Req ...

  6. USACO 3.2 butter 最短路

    堆优化dijkstra /* PROB:butter LANG:C++ */ #include <iostream> #include <cstdio> #include &l ...

  7. 关于bash的shellshock漏洞

    这一漏洞的描述如下: Shellshock (CVE-2014-6271, CVE-2014-6277, CVE-2014-6278, CVE-2014-7169, CVE-2014-7186, CV ...

  8. myeclipse 部署应用

    昨天把MyEclipse10给安装上了,今天想在MyEclipse下启动Tomcat并在浏览器中看到写的Web页面,但是当在浏览器中输入地址时,出现了404错误,出现这个错误的原因是因为没有找到指定的 ...

  9. Eclipse启动Tomcat错误:Several ports (8005,8009) required by Tomcat v6.0 Server at localhost are already

    解决办法: 1.netstat -aon|findstr 8005 可查看指定端口号使用情况 2.tasklist |findstr 10452 找出占用指定进程Id的程序 3.taskkill /p ...

  10. 使用multi curl进行http并发访问

    curl是一款利用URL语法进行文件传输的工具,它支持多种协议,包括FTP, FTPS, HTTP, HTTPS, GOPHER, TELNET等,我们既可以在命令行上使用它,也可以利用 libcur ...