摘要: 一、经典例题 例一:排队接水 题意:n个人到r个水龙头接水,装满水桶的时间分别是t1,t2,t3.... 接水时间是整数且互不相等,怎样安排顺序使每个人等待的 时间和最小。 题解:排队越靠前计算次数越多,因此越小的排在前面。 交换一下看看 例二:均分纸牌 题意:n堆纸牌,每堆若干张,但纸牌总数为n的 阅读全文
posted @ 2017-11-08 21:21 ANhour 阅读(1095) 评论(0) 推荐(1)
摘要: 一、线性动态规划 最长严格上升子序列 #include<iostream> #include<cstdio> using namespace std; int n,ans; int a[5004],dp[5004]; int main() { scanf("%d",&n); for(int i=1; 阅读全文
posted @ 2017-11-08 21:20 ANhour 阅读(808) 评论(0) 推荐(0)
摘要: 题解:模拟 #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> using namespace std; int n,mx; int c[55],ans[55]; char s[55]; int main 阅读全文
posted @ 2017-11-08 16:51 ANhour 阅读(173) 评论(0) 推荐(0)