
---------挑战程序设计---------
是Elie呀
人生苦短,莫忘初衷;凡事相信,凡事期待。认真做事,认真做人!翁恺老师寄语:“其实学习终归是一件痛苦的事情,所以呢面对学习你还是得要认真,用功,努力地去学习。享受的是什么?是学习之后获得的那种成就,快乐是从成就中来的。”
展开
-
P143 二分搜索——最大化平均值
#include<iostream> #include<cstdio> #include<algorithm> using namespace std; const int maxn=1e6+10; const int INF=1e6; int w[maxn],v[maxn],n,k; double y[maxn]; //v-x*w //判断是否满足条...原创 2018-06-04 19:42:43 · 194 阅读 · 0 评论 -
P140 二分搜索——假定一个解并判断是否可行(POJ1064 Cable master)
传送门:POJ1064 Description Inhabitants of the Wonderland have decided to hold a regional programming contest. The Judging Committee has volunteered and has promised to organize the most honest conte...原创 2018-06-01 16:32:14 · 282 阅读 · 0 评论 -
P138 二分搜索——从有序数组中查找某个值(lower_bound)
#include<iostream> #include<cstdio> using namespace std; const int maxn=1e6+10; int a[maxn],n,k; void solve(){ //初始化解的存在范围 int lb=-1,ub=n; //(lb,ub] //重复循环,直到解的存在范围不大于1 ...原创 2018-06-01 15:40:22 · 256 阅读 · 0 评论 -
P142 二分搜索——最大化最小值(POJ2456 Aggressive cows)
传送门:POJ 2456 Description Farmer John has built a new long barn, with N (2 <= N <= 100,000) stalls. The stalls are located along a straight line at positions x1,...,xN (0 <= xi <= 1,00...原创 2018-06-01 18:08:48 · 289 阅读 · 1 评论 -
(DFS八连通)POJ2386 Lake Counting
POJ 2386 P32 挑战程序设计 #include<cstdio> using namespace std; #define MAX_N 210 char field[MAX_N][MAX_N]; int n,m; void dfs(int x,int y){ field[x][y]='.'; for(int dx=-1;dx<=1;dx++){ for...原创 2018-07-25 10:38:53 · 230 阅读 · 0 评论 -
一直往前!贪心法
贪心法是遵循某种规则,不断地选取当前最优策略,而搜索和动态规划则是在多种策略中选取最优解。 挑战程序设计 P39 代码: #include<cstdio> #include<algorithm> using namespace std; //使用硬币的面值 const int V[6]={1,5,10,50,100,500}; int C[6]; int A...原创 2018-07-25 15:05:21 · 128 阅读 · 0 评论 -
3.5 借助水流解决问题的网络流(《挑战程序设计》)
1.最大流最小割 2.二分图匹配 3.最小费用流原创 2018-10-16 14:45:51 · 316 阅读 · 0 评论 -
(尺取法)poj3320 Jessica's Reading Problem
传送门:poj3320 Jessica's Reading Problem #include<iostream> #include<cstdio> #include<set> #include<map> using namespace std; const int maxp=1e6+10; int P; int a[maxp]; void ...原创 2018-10-23 15:04:55 · 165 阅读 · 0 评论