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
Balls
poj Labeling
Balls
3687 拓扑排序!!!!
话说这道题题意我理解的是真纠结,他是你将球按照他的要求放好,而他的要求是你将球放好后从一到n编号 这时的编号来符合要求的条件而偶一开始以为输出标签的标签还和重量相等真是坑爹 其实是按标签从小到大的顺序输出球的重量,题中给的要求也是用标签号表示的进入正题从后向前拓扑使大数数组后面自然小数在前面 我们在存答案的也是从小到大 #include #include #include intg[205][20
youngyangyang04
·
2012-04-10 21:00
ini
NYOJ 431 Dragon
Balls
并查集
路径压缩的经典应用。输入x和y后,可以找到rootx和rooty,则rankk[rootx]++,这是因为rankk[rooty]一定是等于0的,所以不需要加rankk[rooty]。接下来就需要在路径压缩中再加一次了。设fx=father[x],若fx!=x,则在找x的根节点的过程中,rankk[x]+=rankk[fx]即可,这点也是容易理解的。。题目:DragonBalls时间限制:
wmn_wmn
·
2012-04-09 08:00
hdu 3635(Dragon
Balls
)
hdu3635(DragonBalls) 1 /* 2 Author: Leo.W 3 Descriptipn: 龙珠在哪里,那里有多少龙珠,目标龙珠移动了多少次。移动龙珠,并将在一起的龙珠同时移动。 4 How to Do: T A B即将Ath龙珠所在地所有龙珠移动到Bth龙珠所在地 5 Q A显示Ath龙珠所在地ID及此地的龙珠数和Ath龙珠的移动次数
冰王子Leo与ACM一起的成长
·
2012-03-21 22:00
雷电小知识
这些多少也是基础,有用了可以看看 初始化多个子弹(原理是子弹运动的角度不同) void doFire() { int m = 0; for (int i = 0; i <
Balls
.length
jacky1118sally
·
2012-01-27 10:00
Android 游戏 j2me
HDU3635 Dragon
Balls
并查集
//很祼的并查集 #include"UnionFindSet.h" #include usingnamespacestd; intmain() { UFSufs; intt,Case,n,q,a,b; charch; scanf("%d",&t); for(Case=1;Case>a; inttmp=ufs.Find(a); printf("%d%d%d\n",tmp,ufs.rank[tmp]
mishifangxiangdefeng
·
2011-12-29 18:00
c
boj23 Easy problem
问题: Description There is N pairs of
balls
in a small box.
handspeaker
·
2011-11-30 20:00
AS
HDU-3635 Dragon
Balls
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3635题目大意:初始时,有n个龙珠,编号从1到n,分别对应的放在编号从1到n的城市中。现在又2种操作:TAB,表示把A球所在城市全部的龙珠全部转移到B城市。(第一次时,因为A球所在的城市只有一个球,所以只移动1个,如果有多个,则全部移动)。QA,表示查询A。要求得到的信息分别是:A现在所在的城市,A所在
niushuai666
·
2011-11-19 10:00
JOIN
数据结构
c
struct
语言
HDU 3635 Dragon
Balls
(并查集)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3635题目大意:编号为1到N的球分别在N个城市中,有两种操作,T和Q,T表示把球A所在城市的所有球移动到球B所在城市。Q表示输出球A所在城市的编号以及该城市中球的总数和球A被移动了多少次。解题思路:由于每次移动球是将城市所有的球全部移动到另一个城市,因此可以用并查集来做,将两个集合合并,根节点就表示球所
yhrun
·
2011-11-03 10:00
c
Dragon_
Balls
_简单并查集
#include #include #include #include #include #include #include #include using namespace std;const int MAXN = 10010;int n,m;int father[MAXN], rank[MAXN], a,b;int depth[MAXN],t;void make() { for(
beloved_ACM
·
2011-09-09 11:00
hdu 3635 Dragon
Balls
虽然不难,但是很讲究是否理解了并查集的实质#include #include constintMAXN=10000+1234; intn,q; intcon[MAXN]; intp[MAXN]; intnum[MAXN]; intfind(intx) { if(p[x]==x)returnx; intt=p[x];//因为压缩路径的问题,绝对不会重复加(根的值为0) p[x]=find(p[x])
hqd_acm
·
2011-08-01 11:00
POJ3687 Labeling
Balls
(拓扑排序的应用)
给出一些球,从1~N编号,他们的重量都不相同,也用1~N标记加以区分(这里真心恶毒啊,估计很多WA都是因为这里),然后给出一些约束条件,要求编号为a的球必须比b轻,现在要求按编号升序输出每个球的重量,如果有多种解,输出字典序最小的那个。例如:input:15451421323output:24531输出的意思是,编号为1的球的重量是2,编号为2的球重量为5,编号3的球重量为5,编号4的球重量为3,
l04205613
·
2011-07-31 10:00
struct
input
output
hdu 3422 Triangle
ProblemDescriptionKlikestoplaywiththeballs.Thatdayhepiledatriangle(nlayers,layer1start,thefirstlayerhas1ball,thesecodelayerhas2
balls
magicnumber
·
2011-07-28 17:00
POJ/PKU 3687 Labeling
Balls
题目大意:有N个小球,重量从小大排列,同时有N个标签,给出的输出中ab代表标签a标记的球重量小于标签b,题目要求输出按标签1,2,......,N的球。 解法自然是拓扑排序,不过我们可以利用优先队列进行拓扑排序。这样以保证每一个最大的值都存在最靠后的标号上面去 我的代码:#include#include#include#includeusingnamespacestd;intin[205],an
xieshimao
·
2011-06-18 15:00
Flash/Flex学习笔记(44):3D线条与填充
Number=250; varvpx:Number=stage.stageWidth/2; varvpy:Number=stage.stageHeight/2; functioninit():void{
balls
madfroghe
·
2011-04-24 13:00
编程
Flex
Flash
poj 36876 Labeling
Balls
LabelingBallsTimeLimit:1000MS MemoryLimit:65536KTotalSubmissions:5819 Accepted:1455DescriptionWindyhasNballsofdistinctweightsfrom1unittoNunits.Nowhetriestolabelthemwith1toNinsuchawaythat:Notwoballssha
hqd_acm
·
2011-03-26 21:00
input
each
output
Intro to Box2D with Cocos2D Tutorial: Bouncing
Balls
IntrotoBox2DwithCocos2DTutorial:BouncingBallsLikethispost?Followmeon Twitter!BouncingBallExampleThistutorialhelpsgetyoustartedwithBox2DwithCocos2Dbyshowingyouhowtocreateasimpleappthatshowsaballthatyo
waleywen
·
2011-03-10 13:00
object
properties
velocity
processing
Parameters
variables
qmlcanvas,类Html5 canvas的组件
上面其实是一个动态画面截取的一张,效果是一个类似星空扩散的动画.完全是用javascript+qml写出来的.
balls
.js vartId; varcHeight=0; v
jamiesun
·
2010-12-19 19:00
html5
git
Flex
qt
JavaFX
qmlcanvas,类Html5 canvas的组件
上面其实是一个动态画面截取的一张,效果是一个类似星空扩散的动画.完全是用javascript+qml写出来的.
balls
.js vartId; varcHeight=0; v
jamiesun
·
2010-12-19 19:00
html5
git
Flex
qt
JavaFX
SGU126
There are A
balls
in the first box, and
我希望你是我独家记忆
·
2010-12-03 15:00
pku 3687 Labeling
Balls
逆向拓扑!注意
pku3687LabelingBalls逆向拓扑!注意英文太短,直接贴DescriptionWindyhasNballsofdistinctweightsfrom1unittoNunits.Nowhetriestolabelthemwith1toNinsuchawaythat:Notwoballssharethesamelabel.Thelabelingsatisfiesseveralconstr
yzhw@ujs code my life~
·
2010-10-22 02:00
PKU 3687 Labeling
Balls
PKU3687LabelingBalls问题:http://acm.pku.edu.cn/JudgeOnline/problem?id=3687思路:这题理解起来就很困难,等理解透了也还是不会参考:http://hi.baidu.com/archersfate/blog/item/30e66f76734a0c12b051b9ab.html总结:逆向的拓扑排序,等同于对转置图进行正向的拓扑排序(其实
A Za, A Za, Fighting...
·
2010-09-04 11:00
paintComponents()和paintComponent()一字之差
nbsp; public void add(Ball b) {
balls
ross.geller
·
2010-05-19 18:00
component
Balance Your Life
Imagine life as a game in which you are juggling five
balls
in the air.Your name them:work,family,health
jiangduxi
·
2010-01-28 10:00
游戏
工作
生活
UP
AIR
php 数组
$
balls
[$blueIndex].'';?>
netmouse
·
2010-01-15 00:00
PHP
数组
POJ ACM习题【No.3176】
65536K Total Submissions: 4594 Accepted: 2973 Description The cows don't use actual bowling
balls
joe_zxy
·
2009-04-26 10:00
J#
UP
Go
pku 3687 Labeling
Balls
( 有点难想的贪心算法 )
pku3687LabelingBalls(有点难想的贪心算法) 1 #include 2 using namespace std; 3 int in[209]; 4 int map[209][209]; 5 int ans[209]; 6 int main() 7 { 8 int ca; 9 scanf("%d",&ca);10 while(ca--)11 {12
雪竹的天空
·
2008-09-04 23:00
PKU3476 A Game with Colored
Balls
- 两个重要的教训
题目描述:RGB三种颜色的球排成一行,首先消除连续相同颜色最长的最左边的一段,剩下的球左右连接起来继续以上消除过程。打印每次消除小球的颜色和编号。n10000的时候本机上就会出错,数据量小的时候就没问题。最后发现是动态申请的链表导致的!教训1:动态申请内存不能太多,如果需要可以在堆上开大数组用作内存池模拟内存申请。修正之后提交结果返回了WA……我又写了一个暴力算法的程序,然后随机生成了一些数据对比
tiaotiaoyly
·
2008-08-27 22:00
C++ Program Code for 2D Elastic Collision of 2
Balls
C++ProgramCodefor2DElasticCollisionof2Ballsfrom:http://www.plasmaphysics.org.uk/programs/coll2d_cpp.htm//******************************************************************************// This program
牵着老婆满街逛
·
2007-12-25 16:00
生命中的五个球 Five
Balls
of Life
导读:但是家庭、健康、朋友和心灵这四个球是用玻璃做成的。一旦你失手落下,它们可能会少了一角,留下无法挽回的记号、刻痕、损坏甚至碎落一地。它们将永远不会跟以前一样。你必须了解这个道理,并且为平衡你的生命而努力。但要怎么才做得到呢?生命中的五个球FiveBallsofLife几年前,在一所大学的开幕典礼中,可口可乐的首席执行官布赖恩•戴森讲到工作与其他义务的关系:想象生命是一场不停丢掷五个球于空中的游
zhy97031
·
2007-11-23 16:00
生命中的五个球 Five
Balls
of Life
生命中的五个球FiveBallsofLife 几年前,在一所大学的开幕典礼中,可口可乐的首席执行官布赖恩•戴森讲到工作与其他义务的关系:想象生命是一场不停丢掷五个球于空中的游戏。这五个球分别为工作、家庭、健康、朋友和心灵,而且你很努力地掷着这五个球,不让它们落地。很快地你会了解工作是一个橡皮球。如果你不幸失手落下它,它还是会弹回来。但是家庭、健康、朋友和心灵这四个球是用玻璃做成的。一旦你失手落下
imlogic
·
2007-11-22 09:00
Life was like a box of chocolates
Imagine life as a game in which you are juggling some five
balls
in the air.
keep
·
2007-06-27 12:00
F#
UP
AIR
Life was like a box of chocolates
Imagine life as a game in which you are juggling some five
balls
in the air.
keep
·
2007-06-27 12:00
F#
UP
AIR
Given n coins and a pan balance,find the only counterfeit 2
So the class is pretty simple, sum the weights of
balls
and compare.
jellyfish
·
2007-02-27 05:00
REST
Go
上一页
3
4
5
6
7
8
9
10
下一页
按字母分类:
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
其他