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

链接http://acm.hdu.edu.cn/showproblem.php?pid=5804 题意:给你一些商店和他的商品价格,然后给你一个记账本,问你记大了就是1,否则是0 解法:模拟,注意测试数据大小 #include<stdio.h> //#include<bits/stdc++.h> #include<string.h> #include<iostream> #include<math.h> #include<sstream&g…
题目传送门 /* 贪心水题:找出出现次数>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…
[HDU5807] [BestCoder Round #86 1004] Keep In Touch (DP) 题面 有三个人从一张N个点无重边的有向无环图上的三个点出发,每单位时间,他们分别选择当前点的一条出边走下去.有向无环图点有点权,任意时刻他们所在的三个点两两点权相差不超过K.他们可以在任意三个点同时结束.求合法的路径总数.N≤50. 分析 暴力的做法,设\(dp[i][j][k]\)表示第一个人在i,第二个人在j,第三个人在k的方案数,然后枚举三个人接着到的地方x,y,z,倒推\(dp…
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 [题意] 给定一个长度为n(n<=100000)的正整数序列,给出m(m<=100000)个子集合和的记录,问哪些一定比正确的记录多了 [题解] 对正整数序列求和,记录比和大的一定记录多了 HackPoint:sum要开long long ]; int main(){ int T=gi; while(T--){ ; FOR1(i,n)v[i]=gi,sum+=v[i]; FOR1(i,m){ ll p;scanf("%I64d",&p); ");…
A题 Price List 巨水..........水的不敢相信. #include <cstdio> typedef long long LL; int main() { int T; scanf("%d",&T); while(T--) { int n,m,x; scanf("%d%d",&n,&m); LL sum = ; ; i < n; i++) { int x; scanf("%d",&…