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
cow
[Usaco2006 Oct]Another
Cow
Number Game 奶牛的数字游戏 记忆化搜索
奶牛们又在玩一种无聊的数字游戏。输得很郁闷的贝茜想请你写个程序来帮她在开局时预测结果。在游戏的开始,每头牛都会得到一个数N(1 usingnamespacestd; inta[11111111]; intgao(longlongx) { if(x==1)return1; if(x>n; cout<<gao(n)-1<<endl; return0; }
sdj222555
·
2012-11-29 23:00
[Usaco2008 Mar]
Cow
Travelling游荡的奶牛 BFS
奶牛们在被划分成N行M列(2 #include #include #include #include #include usingnamespacestd; intdp[111][111][18]; intvis[111][111][18]; intxx[]={0,1,0,-1}; intyy[]={1,0,-1,0}; intT; structP { intx,y,num; P(){} P(in
sdj222555
·
2012-11-29 23:00
POJ 3180 The
Cow
Porm
这题目实在是很让人无语,FJ真是一个清新可爱的男孩子。。比赛完了查题解才发现是给定一个有向图,求强连通分量。Tarjan算法#include #include #include #include usingnamespacestd; vectorg[10010]; intdfn[10010],low[10010],tag; intstack[10010],s_top; boolinstack[10
sssogs
·
2012-11-29 19:00
POJ 3278 Catch That
Cow
简单的bfs,访问记录,队列实现#include #include #include #include usingnamespacestd; structnode { intpos; intstep; }; queueq; intv[120000]; booljudge(noden) { if(n.pos100000) returnfalse; if(v[n.pos
sssogs
·
2012-11-23 22:00
有1000000头奶排着队,已知每只奶牛的身高,每只奶牛能看到自己前面比自己矮的奶牛,直到被一只比自己高的奶牛挡住。求出每只奶牛分别能看到几只前面的奶牛。
思路:设int数组
cow
里存有每个奶牛的身高。int数组count里存每个奶牛能看到前面的奶牛的个数,这个数组初始化为0.假设count[i]已经求出。
jiyanfeng1
·
2012-11-21 03:00
POJ 2375
Cow
Ski Area
大意:描述了一片滑雪场,并且规定奶牛从一个点只能向它相邻的并且高度不大于它的点运动,现在想要某些点对之间加上缆车使得奶牛业可以从较低点向较高点运动,问最少需要多少辆这样的缆车就可以使得奶牛可以从一个点到滑雪场的每一个角落。思路:对于奶牛的运动,我们分两种情况进行考虑。1、向高度相同运动:应为相互可达,那么只要到达其中一个的话,则整个高度相同的都可以到达,这与强连通分量很相似,所以我们可以把无向边拆
Wall_F
·
2012-11-19 22:00
POJ 2133
Cow
Imposters
因为牌子的种类最多有2^16个,所以搜索一下就可以得到答案。#include #include #include #include #include usingnamespacestd; structT { intn; intc; }; queueq; inttar,len,le,v[68000],E[120]; charstr[20]="11001"; Ttp,tp2; intf(intlen,
sssogs
·
2012-11-18 16:00
POJ 2132
Cow
Math
此题我用的DFS过。DFS每一条路,用res=gcd(res,now),不断更新res值。当访问到2时,用ans=lcm(ans,res),更新答案,即可。剪枝:如果当前的ans可以整除当前的res,就剪掉,因为当ans%res=0,必然有lcm(ans,res)=ans。剩余一个疑问就是:为什么lcm(a,b,c)=lcm(lcm(a,b),c)?#include #include #inclu
sssogs
·
2012-11-18 12:00
poj_3176
Cow
Bowling问题(已解决)
CowBowlingTimeLimit: 1000MS MemoryLimit: 65536KTotalSubmissions: 11089 Accepted: 7256DescriptionThecowsdon'tuseactualbowlingballswhentheygobowling.Theyeachtakeanumber(intherange0..99),though,andlineup
lgh1992314
·
2012-11-17 16:00
POJ 3278 Catch That
Cow
【bfs+队列】
原题链接:http://poj.org/problem?id=3278算法:bfs+队列+STL(C++)PS:bfs入门题目,好高兴啊,终于会用bfs了。CatchThatCowTimeLimit:2000MSMemoryLimit:65536KTotalSubmissions:32679Accepted:10060DescriptionFarmerJohnhasbeeninformedofth
cfreezhan
·
2012-11-10 00:09
acm
解题报告
POJ
模拟
广度优先bfs
数据结构
POJ 3278 Catch That
Cow
【bfs+队列】
原题链接:http://poj.org/problem?id=3278算法:bfs+队列+STL(C++)PS:bfs入门题目,好高兴啊,终于会用bfs了。CatchThatCowTimeLimit: 2000MS MemoryLimit: 65536KTotalSubmissions: 32679 Accepted: 10060DescriptionFarmerJohnhasbeeninform
Cfreezhan
·
2012-11-10 00:00
编程:linux time相关结构体和函数
原:http://blog.csdn.net/water_
cow
/article/details/7521567简介本文旨在为了解Linux各种时间类型与时间函数提供技术文档。
hzraymond
·
2012-11-08 15:00
编程
linux
linux
时间
time
POJ 3673
Cow
Multiplication
一、题目信息CowMultiplicationTimeLimit: 1000MS MemoryLimit: 65536KTotalSubmissions: 10216 Accepted: 6993DescriptionBessieistiredofmultiplyingpairsofnumberstheusualway,sosheinventedherownstyleofmultiplicatio
Sinchb
·
2012-11-07 09:00
Android的Zygote的
COW
(Copy on Write)技术研究
fork()和execve()是标准的Linux系统调用,可以组合生成新的进程开始新的任务。上篇文章学习了fork()的使用,execve()呢就是执行新的文件中的main函数,开始了新的进程任务。fork出的子进程共享父进程的内存结构信息和库链接信息等,而后子进程调用execve()将新进程所需的代码加载到内存
dingran
·
2012-10-29 15:00
Zygote
COW
POJ 3270(
Cow
Sorting)
这题主要是交换时要求代价最小先找到环 相同数字与 同列相连1 第一行为起始序列 第二行为目标序列 13 42 5 12345把一个环中最小的那个与指向的数交换 13245 12345最后交换32 12345 12345或则调来序列中最小的那个数与环中最小数替换(乘船问题?)这样就能得到最优解ans+=min( (sizi-2)*mini+sumi, (sizi+1)*minn+m
nike0good
·
2012-10-24 13:00
POJ3278 Catch That
Cow
题目大意:在一个数轴上,求出由n到k的最小步数,其中n可以+1或者-1或者*2。思路:明显的bfs,因为是求最小的步数,总共有三种走法,这也是BFS的三个入口(或者说bfs应该b的方向),对于每一种走法走到的位置就是bfs抽象的层数上的棋子(想象由一个源点散发开来)而每一种走法相同的时间(从出发到当前)就是扩展出来的层数。 ACprogram:(G++提交WA了,但是换了C++竟然AC了,囧。。)
kg_second
·
2012-10-20 22:00
c
struct
扩展
fallocate与“文件打洞”
这个东西底层的实现不知道是什么情况,至少可以:a.只让文件看起来有那么大,磁盘空间
COW
分配;b.一次把磁盘空间分配完。对于大文件来说,后者似乎要更好,因为文件在磁盘上完全是连续的。
g__gle
·
2012-10-17 23:54
poj 3267 The
Cow
Lexicon
table[i]表示以i为结尾的字符串最优解则有table[i]=min(table[i-1]+1,table[j]+删除字符数)j,j+1,j+2...i删掉字符后能够和词典中的单词匹配#include #include #include #include #include #include #include #include #include #include #include #includ
gyarenas
·
2012-10-14 20:00
String
table
linker
linux进程管理
有生命周期 资源分配的单位,执行的程序的一部分副本 cpu,内存,打开的文件等等都是进程的资源 os:(TASKSTRUCTURE描述跟踪进程)进程有父子关系,任何一个进程都是由其父进程fork自身而来
cow
夜未央7
·
2012-10-14 20:46
进程
什么是异构计算?
同构网络计算系统now或
cow
首先兴起,接着很快涌现出异构网络计算系统,从而使异构计算近年来成为并行/分布计算领域中的主要研究热点之一。
wuhualong1314
·
2012-10-14 12:00
Cow
Picnic
题意:某人有很多牧场,他的牛在一些牧场中放牧,问有多少牧场所有牛都可以到达。思路:水题。刚开始用bfs,检测每一个牛所能到达的牧场,但是很遗憾的MLE若干次,故而求助网络,看他们都有的dfs,仅看到一位仁兄用的bfs,但是他用了vector,我不怎么会用,遂改用dfs做,判断到达每个牧场的牛的个数,进行对比是否==k,是牧场数加1,。#include #include #include #i
sdjzujxc
·
2012-10-13 12:00
Poj 3181 Dollar Dayz
DescriptionFarmer John goes to Dollar Days at The
Cow
Store and discovers an unlimited number of tools
Magic____
·
2012-10-08 08:00
树状数组题目总结(一)
求逆序数是一维树状数组的一个重要应用,POJ3067Japan也是一个求逆序数的题,还有POJ2481
Cow
也是这个类型的,那我们就来总结一下,用树状数组求逆序数的方法。
AClion
·
2012-10-07 22:00
Poj 2184
Cow
Exhibition
CowExhibition TimeLimit:1000MS MemoryLimit:65536KTotalSubmissions:6972 Accepted:2468Description"Fatanddocile,biganddumb,the
Magic____
·
2012-10-07 21:00
USACO section 2.4
Cow
Tours(并查集+最短路)
CowToursFarmerJohnhasanumberofpasturesonhisfarm.Cowpathsconnectsomepastureswithcertainotherpastures,formingafield.But,atthepresenttime,youcanfindatleasttwopasturesthatcannotbeconnectedbyanysequenceofc
nealgavin
·
2012-10-07 10:00
input
Path
constraints
output
pair
distance
hdu1166(敌兵布阵)
} intsum(intx){ ints=0; while(x>0){ s+=c[x]; x-=lowbit(x); } returns; } voidupdate(intx,intval){//
Cow
wangwenhao00
·
2012-10-05 22:00
c
include
usaco 6.1
Cow
XOR(USACO终结,二进制的一些应用)
2005FarmerJohnisstuckwithanotherproblemwhilefeedinghiscows.AllofhisN(1≤N≤100,000)cows(numbered1..N)arelinedupinfrontofthebarn,sortedbytheirrankintheirsocialhierarchy.
Cow
fp_hzq
·
2012-10-04 17:00
Integer
input
Social
hierarchy
output
Numbers
poj 3613
Cow
Relays(矩阵连乘在图论里的应用)
1573DescriptionFortheirphysicalfitnessprogram, N (2≤ N ≤1,000,000)cowshavedecidedtorunarelayraceusingthe T (2≤ T ≤100)
cow
fp_hzq
·
2012-10-02 15:00
Integer
input
each
output
distance
structure
POJ1985
Cow
Marathon (DP/BFS 树的直径) #by Plato
http://poj.org/problem?id=1985题意:给一棵树,求树的直径方法一)tree-DP类似HDU2196,可以参见:http://www.cnblogs.com/celia01/archive/2012/07/30/2615842.html#include #include #include #include #include usingnamespacestd;
XDU_Truth
·
2012-10-01 19:00
vector
struct
poj 2018 Best
Cow
Fences
题目链接:poj 2018BestCowFences这么裸的斜率优化,结果果断调试了两个多小时,长时间不复习真是脑残了……#include #include #include usingnamespacestd; longlongf[100100]; intq[100100]; intmain() { intn,F,a; while(scanf("%d%d",&n,&F)==2) { for
struggle_mind
·
2012-10-01 13:00
poj2018 Best
Cow
Fences
#include #include #include #defineMAXSIZE100500 #definesfscanf #definepfprintf usingnamespacestd; intN,F; intsum[MAXSIZE],t[MAXSIZE]; intstack[MAXSIZE],top,back; longlongXmult(inti,intj,intk) { return
SYLG_li
·
2012-09-29 23:00
ant
POJ 3278 Catch That
Cow
题目链接:http://poj.org/problem?id=3278思路:BFS注意:老是错误,才发现是队列没有清空总结:自己写的代码很烂的,由于是用队列,我想的法子是把每一次(每一步)队列中的数据缓存到数组解决问题,而大神都是...代码如下:#include #include #include #include #include #defineMAX2000001 usingnamespace
ygqwan
·
2012-09-28 16:00
POJ 2184
Cow
Exhibition
题目链接:http://poj.org/problem?id=2184 题意:给定n头牛的聪明指数S和幸福指数F,如果存在S的和TS>=0与F的和TF>=0同时成立时,输出TS与TF的和的最大值sum,否则,输出0。DP数组dp[i]表示当TS为i时右边TF最大值,这样就很巧妙的装化成01背包问题了。那最后的解就是满足条件的dp[i+S]=max(dp[i+S],dp[i]+F);注意:由于TS可
qinmusiyan
·
2012-09-28 15:00
ini
HDU 2717 Catch That
Cow
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2717思路:简单的bfs搜索,每个位置只有三个方向#include #include #include usingnamespacestd; #defineN100001 bools[N]; structnode { intx,time; }; boollimit(intx) { if(x>=0&&xq
qinmusiyan
·
2012-09-24 09:00
hdu 2838
Cow
Sorting(树状数组)
真是得跪,,,我以前做的求逆序数若爆了,连芒果大神都对我无语了。呜呜呜这题和poj那道置换数很像,但是这题要求必须相邻的数才能交换。这就可以用树状数组求数x之前比x大的数量和比x大的数的和。以前只是觉得在x之前插入,然后查询的时候找比x大的,现在发现不对。C1=a1C2=a1+a2C3=a3C4=a1+a2+a3+a4.....树状数组只能求0~N的和。比如3:sum+=a3,x-=lowbit(
cqlf__
·
2012-09-21 14:00
c
struct
System
query
sorting
hdu 2602Bone Collector(0/1背包)
inTeddy’shometowntherewasamanwhowascalled“BoneCollector”.Thismanliketocollectvariesofbones,suchasdog’s,
cow
hellobabygogo3
·
2012-09-20 19:00
c
Integer
less
input
each
output
一个养牛的问题
function get_
cow
_num($year) { $
wayne173
·
2012-09-19 15:00
问题
Bone Collector
inTeddy’shometowntherewasamanwhowascalled“BoneCollector”.Thismanliketocollectvariesofbones,suchasdog’s,
cow
hellobabygogo3
·
2012-09-19 11:00
poj1985 -
Cow
Marathon
想看更多的解题报告:http://blog.csdn.net/wangjian8006/article/details/7870410 转载请注明出处:http://blog.csdn.net/wangjian8006题目大意:有n个农场,这n个农场有一些边连着,然后要
wangjian8006
·
2012-09-18 16:00
c
struct
poj2184
Cow
Exthibition花费为负的01背包
ProblemDescription"Fatanddocile,biganddumb,theylooksostupid,theyaren'tmuch fun..." -CowswithGunsbyDanaLyons Thecowswanttoprovetothepublicthattheyarebothsmartandfun.Inordertodothis,Bessiehasorganizedan
MetalSeed
·
2012-09-08 09:00
用户空间缺页异常pte_handle_fault()分析--(下)--写时复制
在pte_handle_fault()中,如果触发异常的页存在于主存中,那么该异常往往是由写了一个只读页触发的,此时需要进行
COW
(写时复制操作)。
xitong
·
2012-09-07 16:00
异常
用户空间缺页异常pte_handle_fault()分析--(下)--写时复制
在pte_handle_fault()中,如果触发异常的页存在于主存中,那么该异常往往是由写了一个只读页触发的,此时需要进行
COW
(写时复制操作)。
vanbreaker
·
2012-09-07 16:00
thread
cache
struct
File
table
Access
POJ 3267 The
Cow
Lexicon
不删除的话必须在字典当中要有与之匹配的单词,删除的话那么dp[i]=dp[i-1]+1.不删除则必须分析,如果acorw做到w时,假设有一个单词
cow
可以与之匹配
aacm1992
·
2012-08-30 14:00
poj 3278 Catch That
Cow
#include #include #include usingnamespacestd; constintMAX=100001; intn,k,path[MAX]; boolvis[MAX]; voidbfs() { inttmp; queueq; //队列的初始化 while(q.size()!=0) q.pop(); q.push(n); path[n]=0; while(q.size(
yzl_rex
·
2012-08-27 15:00
poj 3270
Cow
Sorting(置换群)
链接:http://poj.org/problem?id=3270做这道题,是昨天的比赛被1003给虐爆了./* ProblemID:poj3270 meaning:给出一列数,要将其排列成升序序列所需的最少花费,ps:cost是交换的两数之和. Analyzing:置换群.黑书p248.找到每个循环节的长度ki和它的最小元素ticost=sum+sum(min(ki-2)*ti,ti+(ki+1
cqlf__
·
2012-08-26 16:00
POJ 3268 Silver
Cow
Party
题目描述:有N(1≤N≤1000)个农场,编号为1~N,每个农场有一头奶牛。这些奶牛将参加在#X(1≤X≤N)号农场举行的派对。这N个农场之间有M(1≤M≤100,000)条单向路,通过第i条路将需要花费Ti(1≤Ti≤100)单位时间。每头奶牛必须走着去参加派对。派对开完以后,返回到它的农场。每头奶牛都很懒,所以总是选择一条具有最短时间的最优路。每头奶牛的往返路线是不一样的,因为所有的路都是单向
paradiserparadiser
·
2012-08-26 13:00
POJ 1985
Cow
Marathon
题意:给出各个农场之间的距离,问你两个农场之间的最长距离是多少。 看到是和噩梦导航有联系的,我一开始就以为还是LCA的问题,我把1986的程序改了一下,结果TLE,所以还是另辟它法,我们知道最远的两个农场一定会在叶子结点之间。假设不在叶子结点,那么它还可以往下走到叶子结点求出最大,这点我也考虑到,在用LCA的时候我用标志位标志了还是超时了。所以两次DFS就好了。代码:#include #in
aacm1992
·
2012-08-22 16:00
c
IE
USACO - 2.3.2 -
Cow
Pedigrees
原创文章转载请注明出处摘要:动态规划一.题目翻译1.描述:农民约翰准备购买一群新奶牛。在这个新的奶牛群中,每一个母亲奶牛都生两个小奶牛。这些奶牛间的关系可以用二叉树来表示。这些二叉树总共有N个节点(3<=N<200)。这些二叉树有如下性质:每一个节点的度是0或2。度是这个节点的孩子的数目。树的高度等于K(1
qingtangpaomian
·
2012-08-21 10:00
USACO
poj 3176
Cow
Bowling
#include #include usingnamespacestd; constintMAX=400; shortdp[MAX][MAX]; intmain() { intn,i,j; while(cin>>n){ for(i=1;i>dp[i][j]; } } for(i=n-1;i>=1;i--){ for(j=1;j<=i;j++) dp[i][j]+=max(dp[i+1][j]
yzl_rex
·
2012-08-20 10:00
Algorithm
System
include
广搜:Catch That
Cow
CatchThatCowTimeLimit:4000/2000ms(Java/Other) MemoryLimit:131072/65536K(Java/Other)TotalSubmission(s):57 AcceptedSubmission(s):35ProblemDescriptionFarmerJohnhasbeeninformedofthelocationofafugitive
lethic
·
2012-08-18 11:00
上一页
47
48
49
50
51
52
53
54
下一页
按字母分类:
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
其他