E-COM-NET
首页
在线工具
Layui镜像站
SUI文档
联系我们
推荐频道
Java
PHP
C++
C
C#
Python
Ruby
go语言
Scala
Servlet
Vue
MySQL
NoSQL
Redis
CSS
Oracle
SQL Server
DB2
HBase
Http
HTML5
Spring
Ajax
Jquery
JavaScript
Json
XML
NodeJs
mybatis
Hibernate
算法
设计模式
shell
数据结构
大数据
JS
消息中间件
正则表达式
Tomcat
SQL
Nginx
Shiro
Maven
Linux
cows
01分数规划 ——最有比率环 pku 3621 Sightseeing
Cows
http://poj.org/problem?id=3621 题意: 给定一张图,边上有花费,点上有收益,点可以多次经过,但是收益不叠加,边也可以多次经过,但是费用叠加。求一个环使得收益和/花费和最大,输出这个比值。 思路:(转载) 首先的一个结论就是,不会存在环套环的问题,即最优的方案一定是一个单独的环,而不是大环套着小环的形式。这个的证明其实非常的简单,大家可以自己想一下(
·
2015-10-31 11:50
pku
poj 2186 Popular
Cows
题目描述:每头奶牛都梦想着成为牧群中最受奶牛仰慕的奶牛。在牧群中,有N头奶牛,1≤N≤10,000,给定M对(1≤M≤50,000)有序对(A, B),表示A仰慕B。由于仰慕关系具有传递性,也就是说,如果A仰慕B,B仰慕C,则A也仰慕C,即使在给定的M对关系中并没有(A, C)。你的任务是计算牧群中受每头奶牛仰慕的奶牛数量。思路:因为仰慕关系具有传递性,因此在同一个强连通分量中的顶点:如果强连通分
·
2015-10-31 11:27
poj
poj 2373 Dividing the Path
Memory Limit: 65536K Total Submissions: 2858 Accepted: 1064 Description Farmer John's
cows
·
2015-10-31 11:24
Path
POJ-3621 Sightseeing
Cows
最优比率环、01分数规划
题目链接:http://poj.org/problem?id=3621 这题是01分数规划问题,详细资料点这里。有了01分数规划的基础后,这个题目就很简单了。构建函数f(mid)=Σ(w[i]-mid*d[i]),然后二分mid,如果图中有正权环,则f(mid)>0,则还有更优解l=mid,否则r=mid。 1 //STATUS:C++_AC_563MS_296KB 2
·
2015-10-31 11:23
poj
HDU 3045 Picnic
Cows
HDU_3045 这个题目如果一开始把各个值排序之后的话,就和POJ_3709那个题目基本一样了,只不过看discuss上说这个题目一开始读数据的时候就要用long long int。 剩下的工作就是和POJ_3709一样了,用斜率优化+单调队列的dp去做。 #include<stdio.h>#incl
·
2015-10-31 11:47
HDU
hdu 2711&&poj2182 Lost
Cows
(线段树)
从后往前查第一个为0的奶牛肯定应该排在第一个。每次从后往前找到第一个为0的数,这个数应该插在第j位。查找之后,修改节点的值为极大值,当整棵树的最小值不为0的时候查找结束。 至于这种查找修改的操作,再没有比线段树效率更高的了。 #include<stdio.h> #include<string.h> #include<stdlib.h>
·
2015-10-31 11:42
poj
poj 2387 Til the
Cows
Come Home(dijkstra算法)
题目链接:http://poj.org/problem?id=2387 题目大意:起点一定是1,终点给出,然后求出1到所给点的最短路径。 注意的是先输入边,在输入的顶点数,不要弄反哦~~~ 1 #include <iostream> 2 #include <cstdio> 3 using namespace std; 4 int map[2010][2
·
2015-10-31 11:53
dijkstra
POJ3615 Cow Hurdles
65536K Total Submissions: 4584 Accepted: 1990 Description Farmer John wants the
cows
·
2015-10-31 11:13
poj
POJ 2481
Cows
(树状数组)
Cows
Time Limit: 3000MS Memory Limit: 65536K Total Submissions: 8497 Accepted
·
2015-10-31 11:41
树状数组
[poj 2186]Popular
Cows
[Tarjan强连通分量]
题意: 有一群牛, a会认为b很帅, 且这种认为是传递的. 问有多少头牛被其他所有牛认为很帅~ 思路: 关键就是分析出缩点之后的有向树只能有一个叶子节点(出度为0). 做法就是Tarjan之后缩点统计出度. #include <cstdio> #include <cstring> #include <stack> #includ
·
2015-10-31 11:54
tar
Til the
Cows
Come Home(赶牛回家)
poj 2387 题目大意:求出图中最短的路径 解决:迪杰斯特拉 或者 spfa 在此处用spfa(队列) #include <iostream> #include <cstdio> #include <queue> using namespace std; const int N=1005; const int MAX=0x3f3f3f3f;
·
2015-10-31 11:13
home
poj3176
Memory Limit: 65536K Total Submissions: 8553 Accepted: 5607 Description The
cows
·
2015-10-31 10:14
poj
poj3267
nbsp;65536K Total Submissions: 4716 Accepted: 2144 Description Few know that the
cows
·
2015-10-31 10:13
poj
poj3274
Total Submissions: 6120 Accepted: 1846 Description Farmer John's N
cows
·
2015-10-31 10:10
poj
【USACO】
Among the large Wisconsin cattle ranchers, it is customary to brand
cows
with serial numbers to please
·
2015-10-31 10:36
USACO
UVA 10491
Cows
and Cars
#include<stdio.h>#include<string.h>double
COWS
, CARS, SHOW;int main(){ while(scanf("
·
2015-10-31 10:44
uva
加上减去DFS解决USACO Healthy Holsteins
Description Farmer John prides himself on having the healthiest dairy
cows
in the world.
·
2015-10-31 10:34
health
POJ 3252 Round Numbers(数位DP)
Limit: 65536K Total Submissions: 6983 Accepted: 2384 Description The
cows
·
2015-10-31 10:28
number
poj3670
Limit: 65536K Total Submissions: 4383 Accepted: 2149 Description The
cows
·
2015-10-31 09:01
poj
POJ-2186 Popular
Cows
强连通分量
题目链接:http://poj.org/problem?id=2186 求出度为0的强连通分量的点的个数。 1 //STATUS:C++_AC_94MS_920KB 2 #include <functional> 3 #include <algorithm> 4 #include <iostream> 5 //#incl
·
2015-10-31 09:05
poj
PKU/POJ 3275 Ranking the
Cows
关键是要明确在最坏情况下需要比较n * (n - 1) / 2次。 之后的事情就简单了,把已得到的两两关系算出来,然后看还差多少。O(nm)。 1 #include < cstdio > 2 #include < vector > 3 using
·
2015-10-31 09:06
rank
PKU/POJ 3269 Building A New Barn
由于题目说
cows
never graze in spots that are horizontally or vertically adjacent,那么被占满的情况就只有n是奇数
·
2015-10-31 09:06
Build
POJ 3660 Cow Contest(传递闭包floyed算法)
Submissions: 5989 Accepted: 3234 Description N (1 ≤ N ≤ 100)
cows
·
2015-10-31 09:17
test
POJ 2186.Popular
Cows
(强连通)
强连通缩点,统计入度为1的缩点后的点的个数 个数1的话输出这个强连通分量的点的数量 否则输出0; code /* Kosaraju算法,无向图的强连通分量,时间复杂度O(n+m) 思路: 按照图G的深度遍历序列,在G的反图上进行深搜 能够搜到的点集就是一个强联通分量 */ #include <iostream&
·
2015-10-31 09:31
poj
poj 2182 lost
cows
树状数组,二分
线段树做法 http://www.cnblogs.com/wuyiqi/archive/2011/12/21/2295391.html 从后往前操作 View Code #include<cstdio>#include<cstring>const int maxn = 80001;int a[maxn],c[maxn],ans[maxn],n;int low
·
2015-10-31 08:12
树状数组
USACO习题:Milking
Cows
这道题目,给你一组时间范围,求最大的时间跨度和最大的时间段间隔。题目看似挺简单,但是如果不加考虑却会发现其中对于时间间隔的处理,有多种情况。也就是会所程序里可能会出现出多的判断语句,使得代码变得非常难写而且容易出错。 我的第一版解法 我采用了一种比较奇怪的数据结构,就是将链表和线性表结合。线性表用于表示一条时间轴,链表用于表示不同时间的跨度。 以样例数据为例 300 10
·
2015-10-31 08:22
USACO
最短路径__Cow Contest ( Poj 3660)
DescriptionN (1≤ N ≤100)
cows
,convenientlynumbered1..N,areparticipatinginaprogrammingcontest.Asweallknow
y1196645376
·
2015-10-31 08:00
最短路径
floyd
POJ 2186 Popular
Cows
Popular
Cows
Time Limit: 2000ms Memory Limit: 65536KB This problem will be judged on PKU.
·
2015-10-31 08:30
poj
最短路径_Til the
Cows
Come Home (Poj 2387)
DescriptionBessieisoutinthefieldandwantstogetbacktothebarntogetasmuchsleepaspossiblebeforeFarmerJohnwakesherforthemorningmilking.Bessieneedsherbeautysleep,soshewantstogetbackasquicklyaspossible. Farme
y1196645376
·
2015-10-30 21:00
最短路径
dijkstra
H-The Cow Lineup(POJ 1989)
30000K Total Submissions: 5367 Accepted: 3196 Description Farmer John's N
cows
·
2015-10-30 16:38
poj
poj 2182 Lost
Cows
Lost
Cows
Time Limit: 1000MS Memory Limit: 65536K Total Submissions
·
2015-10-30 15:14
poj
POJ 2418
Cows
(树状数组)
Cows
Time Limit: 3000MS Memory Limit: 65536K Total Submissions: 9618
·
2015-10-30 15:38
树状数组
poj 3348
Cows
凸包 求多边形面积 计算几何 难度:0 Source:CCC207
Cows
Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 7038
·
2015-10-30 13:28
source
POJ 1947 Rebuilding Roads 树形dp 难度:2
Limit: 30000K Total Submissions: 9105 Accepted: 4122 Description The
cows
·
2015-10-30 13:08
Build
POJ 2182 Lost
Cows
POJ_2182 没想到线段树也可以这么用,确实线段树太灵活了…… 这个题目可以转化成从后向前依次查询,比如当前奶牛的前面有x个号码比它小的奶牛,那么它就应该在剩余的数的序列中排第x+1。因此,我们可以维护一个线段树,节点值表示当前区间内还有多少个数,当寻找第x+1大的数时,可以自顶向下查找,找到之后删去这个数,即自底向上更新一遍节点的值
·
2015-10-30 13:51
poj
poj 3660 Cow Contest Flyod
Submissions: 5989 Accepted: 3234 Description N (1 ≤ N ≤ 100)
cows
·
2015-10-30 13:58
test
poj 2431 Expedition 贪心+优先队列
Memory Limit: 65536K Total Submissions: 7707 Accepted: 2263 Description A group of
cows
·
2015-10-30 13:53
优先队列
强连通(当模板用)——pku2186Popular
Cows
有向图强连通分量的Tarjan算法 有个比较好的讲解http://www.byvoid.com/blog/scc-tarjan/zh-hans/ 学习一下,贴个比较好的模板 View Code #include <iostream>#include <stack>using namespace std; const int MAXN = 10000 +
·
2015-10-30 12:59
pku
最大递增子序列——[Usaco2006 Oct]Hungry
Cows
饥饿的奶牛
N*N View Code Nlog(N) 觉得这个更接近于贪心的思想 二分查找,可以更新则不断把a[]中的子数更新小,否则增加a[] View Code #include<stdio.h>int s[5009];int a[5009];int n;int lis(){ int l,r,mid,len=1; a[1]=s[1];
·
2015-10-30 12:55
USACO
xtu summer individual 1 D - Round Numbers
65536KB 64bit IO Format:%I64d & %I64u Description The
cows
·
2015-10-30 11:57
number
poj 2481
cows
树状数组 老少皆宜版解答
请看几段区间 1 -------------- 2 ------------- 3 -------- 4
·
2015-10-30 10:43
树状数组
E-Eating Together(POJ 3670)
Limit: 65536K Total Submissions: 5579 Accepted: 2713 Description The
cows
·
2015-10-30 10:01
get
F-Dining
Cows
(POJ 3671)
Dining
Cows
Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 
·
2015-10-30 10:00
poj
A-Apple Catching(POJ 2385)
Submissions: 8759 Accepted: 4264 Description It is a little known fact that
cows
·
2015-10-30 10:00
apple
zoj 2868 Incredible
Cows
二分状态搜索
直接暴力搜索会超时,所以要进行优化。优化的方法是,将物品分成两堆。首先,记录下第一堆中物品价值累加可能出现的值,之后在对这个数组排序。之后,在对第二堆进行搜索。对于每种状态,在数组中找出一个值使得两个数值相加越接近sum。#include usingnamespacestd; intans,cnt,m1,m2,sum,half,a[100],b[100],vis[1<<18]; voiddfs1
xinag578
·
2015-10-28 21:00
区间DP-POJ-3186-Treats for the
Cows
TreatsfortheCowsTimeLimit:1000MSMemoryLimit:65536KTotalSubmissions:4746Accepted:2445DescriptionFJhaspurchasedN(1 #include #include #include #include #include #defineMAX2005 usingnamespacestd; intv[M
Roy_Yuan
·
2015-10-28 11:00
c
dp
劣质代码评析——猜数字问题(上)
【题目】 猜数字(又称 Bulls and
Cows
)是一种大概于20世纪中期兴起于英国的益智类小游戏。一般由两个人玩,也可以由一个人和电脑玩,在纸上、在网上都可以玩。
·
2015-10-28 09:46
代码
xtu数据结构 H. City Horizon
lld Java class name: Main Farmer John has taken his
cows
·
2015-10-28 08:02
数据结构
POJ 3250 Bad Hair Day 简单DP 好题
Description Some of Farmer John's N
cows
(1 ≤ N ≤ 80,000) are having a bad hair
·
2015-10-28 08:06
AIR
POJ3617 Best Cow line 简单题
Best Cow Line Description FJ is about to take his N (1 ≤ N ≤ 2,000)
cows
·
2015-10-28 08:58
poj
上一页
11
12
13
14
15
16
17
18
下一页
按字母分类:
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
其他