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

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…
题目传送门 /* 贪心水题:找出出现次数>1的次数和res,如果要减去的比res小,那么总的不同的数字tot不会少: 否则再在tot里减去多余的即为答案 用set容器也可以做,思路一样 */ #include <cstdio> #include <iostream> #include <cstring> #include <string> #include <algorithm> using namespace std; ; const i…
题目传送门 /* m数组记录出现的花色和数值,按照数值每5个搜索,看看有几个已满足,剩下 5 - cnt需要替换 ╰· */ #include <cstdio> #include <algorithm> #include <iostream> #include <cstring> #include <string> using namespace std; ; const int INF = 0x3f3f3f3f; int main(void)…
题目传送门 /* 暴力:模拟枚举每一个时间的度数 详细解释:http://blog.csdn.net/enjoying_science/article/details/46759085 期末考结束第一题,看看题解找找感觉:) */ #include <cstdio> #include <algorithm> #include <cstring> #include <vector> #include <iostream> using namespa…
题目传送门 /* 字符串处理:是一道水题,但是WA了3次,要注意是没有加'\0'的字符串不要用%s输出,否则在多组测试时输出多余的字符 */ #include <cstdio> #include <algorithm> #include <cstring> #include <cmath> using namespace std; typedef long long ll; ; const int INF = 0x3f3f3f3f; char ss[MAXN…
Problem Description It is the king's birthday before the military parade . The ministers prepared a rectangle cake of size n×m(1≤n,m≤10000) . The king plans to cut the cake himself. But he has a strange habit of cutting cakes. Each time, he will cut…
题目链接:http://bestcoder.hdu.edu.cn/contests/contest_showproblem.php?cid=748&pid=1001 题解: 1.trie树 关键是如何将科目与分数进行对应,即如果将字符串与数字对应.由于之前解除了字典树,所以就想到用字典树存储单词,并为每种编上编号,之后就用这个编号与分数对应. 就个人观点而言,a[][]数组应该不用清零,因为下个case会将之前的case覆盖掉,但是错了,也找不出原因.所以以后为了安全起见,不管是否会被覆盖,都清…
题解  题目 1001 GT and sequence 注意先特判000的情况:如果读入的数据有000,那么去掉所有的000且最后答案和000取一个max. 剩下的正数显然全部乘起来比较优. 对于负数的话,如果个数是奇数个我们就去掉绝对值最小的那一个,然后全部乘起来即可. 1002 GT and numbers 如果AAA大于BBB那么显然无解. 考虑把AAA和BBB分解质因数. 若BBB存在AAA没有的质因数也显然无解. 对于某一个AAA的质因数的次数.为了加速接近BBB,它一定是每次翻倍,最…
题目链接 题意:给N条信息,每个信息代表有x个人从开始的时间 到 结束的时间在餐厅就餐, 问最少需要多少座位才能满足需要. 分析:由于时间只有24*60 所以把每个时间点放到 数组a中,并标记开始的时间+x, 结束的时间 -x.最后累加比较. 如果时间点太多的时候可以把时间点放到结构体里,排序,然后依次枚举结构体. #include <iostream> #include <cstring> #include <cstdlib> #include <cmath&g…
题目链接 : http://bestcoder.hdu.edu.cn/contests/contest_chineseproblem.php?cid=641&pid=1003 题意 : 给N集合, 每个集合由若干个正整数组成, 要求划分为L个部分, 使得每个部分的所有集合的交集非空 能划分输出YES, 否则NO 思路 : 一共N个集合, 划分的个数为1 - N个, 所以当 L > N 时必然是不行的 考虑如何取到最小的划分个数cnt, 如果 cnt <= L 则可行 方法 : 记录所有…