贪心
文章平均质量分 79
星琳之梦
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
poj3617字典序问题【贪心】
!!!好大一个坑…字符输入是一个一个的!!!可以用cin.getline();但是时间慢, 也可以用 scanf("%s", tmp);s[i] = tmp[0];参考了网上的思路发现,还可以用scanf(" %c", &ch);在格式串中,空格的意思是匹配输入中的所有换行、TAB、空格,所以加上一个空格,就可以屏蔽掉在输入中的所有的不愉快的因素了。我的原创 2016-04-09 12:02:37 · 4105 阅读 · 3 评论 -
poj3069简单贪心
Saruman's ArmyTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 6766 Accepted: 3472DescriptionSaruman the White must lead his army along a straight path原创 2016-04-09 15:14:33 · 316 阅读 · 0 评论 -
poj3253切割木板(哈夫曼树) 贪心【优先队列】
Fence RepairTime Limit: 2000MS Memory Limit: 65536KTotal Submissions: 37272 Accepted: 12078DescriptionFarmer John wants to repair a small length of the fence ar原创 2016-04-09 16:03:09 · 3296 阅读 · 0 评论 -
poj2533DP最长上升序列
Longest Ordered SubsequenceTime Limit: 2000MS Memory Limit: 65536KTotal Submissions: 43875 Accepted: 19354DescriptionA numeric sequence of ai is ordered if a1 a2原创 2016-04-15 17:48:54 · 357 阅读 · 0 评论 -
01背包问题【简单背包,UVA624】
简单01背包每件物品都有两种选择,要或者不要。#include #include #include using namespace std;#define maxn 102int w[maxn],v[maxn];int dp[maxn][10002];//从前i个物品中选出总重量不超过j的物品的最大价值 int main(){ int n,W;原创 2016-04-09 21:41:55 · 321 阅读 · 0 评论 -
ACM总结——最长公共子序列 & 最长不减(不增)子序列
转自:http://blog.sina.com.cn/s/blog_6a3344990100xyhg.htmlACM总结——最长公共子序列 & 最长不减(不增)子序列两个经典DP一、最长公共子序列(Longest Common Subsequence:LCS)设有两个序列A[1...m]和B[1...n],分别对A和B进行划分子序列A[1转载 2016-04-10 09:45:33 · 512 阅读 · 0 评论 -
最长公共子序列 & 最长不减(不增)子序列-例题题解【poj1458,poj2250,poj1159】
Poj1159PalindromeTime Limit: 3000MS Memory Limit: 65536KTotal Submissions: 58763 Accepted: 20419DescriptionA palindrome is a symmetrical string, that is,原创 2016-04-15 13:42:45 · 963 阅读 · 0 评论 -
hdu4004 Frog’s Game【二分+贪心】
开始的想法是递归做……然而题目规模这么大,必然是TLE的#include #include using namespace std;#define inf 1000000002#define maxn 500005#define max(x,y) x>y?x:y#define min(x,y) x<y?x:ylong A[maxn];long L,n,M,a原创 2016-05-19 16:20:07 · 480 阅读 · 0 评论
分享