上一页 1 ··· 32 33 34 35 36 37 38 39 40 ··· 47 下一页
摘要: 题目传送门 1 /* 2 暴力:每次更新该行的num[],然后暴力找出最优解就可以了:) 3 */ 4 #include 5 #include 6 #include 7 #include 8 #include 9 using namespace std;10 11 const in... 阅读全文
posted @ 2015-05-27 18:53 Running_Time 阅读(144) 评论(0) 推荐(0)
摘要: 题目传送门 1 /* 2 字符串处理:回文串是串联的,一个一个判断 3 */ 4 #include 5 #include 6 #include 7 #include 8 #include 9 using namespace std;10 11 const int MAXN = 1e... 阅读全文
posted @ 2015-05-27 18:52 Running_Time 阅读(181) 评论(0) 推荐(0)
摘要: 题目传送门 1 /* 2 题意:给n个棍子,组成的矩形面积和最大,每根棍子可以-1 3 贪心:排序后,相邻的进行比较,若可以读入x[p++],然后两两相乘相加就可以了 4 */ 5 #include 6 #include 7 #include 8 #include 9 usi... 阅读全文
posted @ 2015-05-26 20:12 Running_Time 阅读(130) 评论(0) 推荐(0)
摘要: 题目传送门 1 /* 2 题意:给出m个位置,每次把[p,len-p+1]内的字符子串反转,输出最后的结果 3 字符串处理:朴素的方法超时,想到结果要么是反转要么没有反转,所以记录 4 每个转换的次数,把每次要反转的反转就不超时了:) 5 */ 6 #... 阅读全文
posted @ 2015-05-26 17:28 Running_Time 阅读(117) 评论(0) 推荐(0)
摘要: 题目传送门 1 /* 2 模拟:这就是一道模拟水题,看到标签是贪心,还以为错了呢 3 题目倒是很长:) 4 */ 5 #include 6 #include 7 #include 8 #include 9 #include 10 using namespace std;11 ... 阅读全文
posted @ 2015-05-26 17:27 Running_Time 阅读(134) 评论(0) 推荐(0)
摘要: 题目传送门 1 /* 2 题意:b+1,b+2,...,a 所有数的素数个数和 3 DP+埃氏筛法:dp[i] 记录i的素数个数和,若i是素数,则为1;否则它可以从一个数乘以素数递推过来 4 最后改为i之前所有素数个数和,那么ans = dp[... 阅读全文
posted @ 2015-05-26 14:43 Running_Time 阅读(151) 评论(0) 推荐(0)
摘要: 题目传送门 1 /* 2 题意:两堆牌,每次拿出上面的牌做比较,大的一方收走两张牌,直到一方没有牌 3 queue容器:模拟上述过程,当次数达到最大值时判断为-1 4 */ 5 #include 6 #include 7 #include 8 #include 9 #incl... 阅读全文
posted @ 2015-05-26 14:41 Running_Time 阅读(146) 评论(0) 推荐(0)
摘要: 题目传送门 1 /* 2 题意:问最少增加多少值使变成递增序列 3 贪心:排序后,每一个值改为前一个值+1,有可能a[i-1] = a[i] + 1,所以要 >= 4 */ 5 #include 6 #include 7 #include 8 using namespace s... 阅读全文
posted @ 2015-05-26 14:40 Running_Time 阅读(141) 评论(0) 推荐(0)
摘要: 题目传送门 1 /* 2 水题:ans = (1+2+3+...+n) * k - n,开long long 3 */ 4 #include 5 #include 6 #include 7 #include 8 using namespace std; 9 10 typedef lo... 阅读全文
posted @ 2015-05-26 14:38 Running_Time 阅读(156) 评论(0) 推荐(0)
摘要: 题目传送门 1 /* 2 模拟水题,排序后找出重复的ip就可以了 3 */ 4 #include 5 #include 6 #include 7 #include 8 #include 9 #include 10 using namespace std;11 12 const in... 阅读全文
posted @ 2015-05-25 18:01 Running_Time 阅读(332) 评论(0) 推荐(0)
摘要: 题目传送门 1 /* 2 字符串处理:要求解码,然而二维数组开不下,可以直接输出 3 只要在余数的地方判断一下就行了,vector的效率不高 4 */ 5 #include 6 #include 7 #include 8 #include 9 #include 10 #inc... 阅读全文
posted @ 2015-05-25 17:59 Running_Time 阅读(263) 评论(0) 推荐(0)
摘要: 题目传送门 1 /* 2 找规律:题目真心读不懂,排列组合的题目 3 */ 4 #include 5 #include 6 #include 7 #include 8 using namespace std; 9 10 typedef long long ll;11 12 const... 阅读全文
posted @ 2015-05-25 17:57 Running_Time 阅读(166) 评论(0) 推荐(0)
摘要: 题目传送门 1 /* 2 双拓扑排序:抄的,以后来补 3 详细解释:http://blog.csdn.net/u012774187/article/details/40736995 4 */ 5 #include 6 #include 7 #include 8 ... 阅读全文
posted @ 2015-05-22 21:05 Running_Time 阅读(171) 评论(0) 推荐(0)
摘要: 题目传送门 1 /* 2 题意:从上到下,找最短路径,并输出路径 3 DP:类似数塔问题,上一行的三个方向更新dp,路径输出是关键 4 */ 5 #include 6 #include 7 #include 8 #include 9 #include 10 #include ... 阅读全文
posted @ 2015-05-22 18:28 Running_Time 阅读(189) 评论(0) 推荐(0)
摘要: 题目链接 题意: 给出若干个点的坐标,用一个W*H的矩形去覆盖,问最多能覆盖几个点。 思路: 这是2014上海全国邀请赛的题目,以前写过,重新学习扫描线。首先把所有点移到第一象限([0, 40000]),每个点从左到右排序,每个点在Y轴看成[y,y+H]的线段,扫描线从左到右扫描,把这条线段在线段树 阅读全文
posted @ 2015-05-22 18:25 Running_Time 阅读(245) 评论(0) 推荐(0)
上一页 1 ··· 32 33 34 35 36 37 38 39 40 ··· 47 下一页