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
Sticks
练习一1001
There is a pile of n wooden
sticks
. The length and weight of each stick are known in advance.
baidu_34275752
·
2016-03-25 16:00
POJ 2452
Sticks
Problem
SticksProblemTimeLimit: 6000MS MemoryLimit: 65536KTotalSubmissions: 10282 Accepted: 2723DescriptionXuanxuanhasnsticksofdifferentlength.Oneday,sheputsallhersticksinaline,representedbyS1,S2,S3,...Sn.Aft
a2459956664
·
2016-03-25 16:00
1001 wooden
sticks
1001 ProblemBThereisapileofnwoodensticks.Thelengthandweightofeachstickareknowninadvance.问题:加工一些木棍,当之后加工的木棍,长、重都不小于前一根时,不需要花费更多的时间,否则,时间加一分钟,求加工所有木棍,所需的最短时间。思路:将所有木棍的长由小到大排序,在长度相同的情况下,按重量排序,因为木棍的长度顺序确定
diyutianxie
·
2016-03-24 21:00
POJ 2653 Pick-up
sticks
【计算几何入门】
http://poj.org/problem?id=2653Pick-upsticksTimeLimit: 3000MS MemoryLimit: 65536KTotalSubmissions: 11638 Accepted: 4390DescriptionStanhasnsticksofvariouslength.Hethrowsthemoneatatimeonthefloorinarandom
yuzhiwei1995
·
2016-03-24 20:00
poj2653 Pick-up
sticks
计算几何 线段相交
Pick-upsticksTimeLimit: 3000MS MemoryLimit: 65536KTotalSubmissions: 11634 Accepted: 4387DescriptionStanhasnsticksofvariouslength.Hethrowsthemoneatatimeonthefloorinarandomway.Afterfinishingthrowing,Sta
EventQueue
·
2016-03-23 18:00
算法
ACM
poj
计算几何
hdu 1051 Wooden
Sticks
问题描述Thereisapileofnwoodensticks.Thelengthandweightofeachstickareknowninadvance.Thesticksaretobeprocessedbyawoodworkingmachineinonebyonefashion.Itneedssometime,calledsetuptime,forthemachinetopreparepro
qq_31237061
·
2016-03-15 21:00
Wooden
Sticks
(贪心)
WoodenSticksTimeLimit:1000MS MemoryLimit:10000KB 64bitIOFormat:%I64d&%I64uSubmit Status Practice POJ1065DescriptionThereisapileofnwoodensticks.Thelengthandweightofeachstickareknowninadvance.Th
liangzhaoyang1
·
2016-03-13 16:00
贪心
Wooden
Sticks
设置优先级 POJ 1065 Wooden
Sticks
POJ1065题目大意如下:给出N段木头的数据,每段木头的数据表示形式为:(L,W)。表示的是木头的长度和质量,但是有一个要求(题目我也没有看太懂==,只解释一下大致意思),如果前一段木头数据的字典序小于之前的木头数据,就会花费一些时间。现在给出一些木头的数据,要你给出一个方案,使得花费的时间最少。这个题目其实很简单,书上布置的这个作业要求用DP方法,但是今天做这个题的时候,并没有想出DP方法,第
kornberg_fresnel
·
2016-03-12 19:00
算法
ACM
poj
ICPC
POJ 1011
Sticks
很经典的dfs剪枝,被困了一个晚上,第二天成功出逃,贴代码纪念下#include #include #include #include #include #include #include usingnamespacestd; #defineMAX66 inta[MAX]; intsum;//总长度 intmax_;//最大的一段 intevery;//每次循环保存一段的长度 intresult;
woyuhuaijin
·
2016-03-11 12:00
poj
DFS
POJ 1011
Sticks
(dfs + 厉害的剪枝)
POJ1011拿2362的代码来交果断超时,研究了半天也没整出来。看了大神的剪枝方法,简直五体投地。详见代码。参考博客:http://blog.sina.com.cn/s/blog_7d3ee9f50100wiy4.html#include #include #include #include usingnamespacestd; boolcmp(inta,intb){ returna>b; }
Strokess
·
2016-03-10 18:00
poj1011-
Sticks
dfs各种剪枝
SticksTimeLimit: 1000MS MemoryLimit: 10000KTotalSubmissions: 133058 Accepted: 31236DescriptionGeorgetooksticksofthesamelengthandcutthemrandomlyuntilallpartsbecameatmost50unitslong.Nowhewantstoreturnst
EventQueue
·
2016-03-10 18:00
算法
搜索
ACM
poj
DFS
POJ 1011
Sticks
【dfs】
SticksTimeLimit: 1000MS MemoryLimit: 10000KTotalSubmissions: 132725 Accepted: 31172DescriptionGeorgetooksticksofthesamelengthandcutthemrandomlyuntilallpartsbecameatmost50unitslong.Nowhewantstoreturnst
mengxiang000000
·
2016-03-02 19:00
poj
1011
HDU1051 Wooden
Sticks
WoodenSticksTimeLimit:2000/1000MS(Java/Others) MemoryLimit:65536/32768K(Java/Others)TotalSubmission(s):16395 AcceptedSubmission(s):6731ProblemDescriptionThereisapileofnwoodensticks.Thelengthandw
lk951208
·
2016-02-29 20:00
贪心
zstu 1024 Wooden
Sticks
重点是结尾的储存。。能接在前面列接在前面列。。这样总体就会更加紧密。。突然想到俄罗斯方块。。#include #include #include #definemaxn5010 usingnamespacestd; structsb { intw; intl; booloperator<(constsb&wakaka)const { if(l==wakaka.l) returnw
qq_32995183
·
2016-02-28 13:00
贪心
UVa 10003 Cutting
Sticks
dp : 线性dp triangulation三角剖分
UVA-10003CuttingSticksTimeLimit: 3000MS MemoryLimit: Unknown 64bitIOFormat: %lld&%lluSubmit StatusThequestionisfrom here.MySolution线性dp三角剖分类题目的经典吧,状态:d[i][j]表示切割i-j这一段的最小费用,0 #include //#defineLOCAL u
ProLightsfxjh
·
2016-02-28 11:00
ACM
uva
三角剖分
线性dp
UVA 10003 Cutting
Sticks
(区间dp)
题目链接:UVA-10003CuttingSticks题意给一长度为L的棍子,和n个切割点,每次切割的代价为当前的棍子的长度,问最少的总切割代价是多少。思路典型的区间dpdp[i][j]=min(dp[i][k]+dp[k][j]+a[j]-a[i])|i代码递推#include #include #include #include #include #include #include usin
to_be_better
·
2016-02-27 16:00
dp
UVA 10003(p278)----CUtting
Sticks
#include #include usingnamespacestd; constintmaxn=100; constintINF=1e7; intd[maxn][maxn]; intl,n,a[maxn]; intsolve(intl,intr) { if(d[l][r]
wang2147483647
·
2016-02-26 14:00
POJ 2513 Colored
Sticks
欧拉路+字典树
点击打开链接题意;给定一些木棒,木棒两端都涂上颜色,求是否能将木棒首尾相接,连成一条直线,要求不同木棒相接的一边必须是相同颜色的。思路注意1此题需要构建无向图;2通过字典树得到每种颜色所对应的编号3通过判断是否为欧拉路或欧拉回路 无向图欧拉回路 :图联通,并且所有的点的度都为偶数 无向图欧拉路 :图联通,并且只有两个点的度都为为奇数 联通的判断利用并查集字典树用于映射编号;#inclu
became_a_wolf
·
2016-02-22 01:00
Game With
Sticks
A.GameWithStickstimelimitpertest1secondmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputAfterwinninggoldandsilverinIOI2014,AkshatandMalvikawanttohavesomefun.Nowtheyareplayingagameon
helloiamclh
·
2016-02-20 13:00
【CodeForces 471A】MUH and
Sticks
题题意给你六根木棍的长度,熊需要头比身体短,大象需要头和身体一样,四肢要一样长,否则就是外星人。请你判断能组成哪一个。分析暴力,循环看一下每根有几根相同的,然后如果有四根都是有四根相同的,有两根是有两根相同的,或者有六根是有六根相同的,那就是大象,如果出现有五根相同的,或者不满足大象但是有四根四根相同,那就是熊,其它情况就是外星人。当时是另一种做法。感觉现在的做法思路更简单。代码#include
水郁
·
2016-02-17 22:00
ZOJ1025 Wooden
Sticks
题目:DescriptionThereisapileofnwoodensticks.Thelengthandweightofeachstickareknowninadvance.Thesticksaretobeprocessedbyawoodworkingmachineinonebyonefashion.Itneedssometime,calledsetuptime,forthemachineto
_IanXiao
·
2016-02-13 13:05
zoj
1025
动态规划
贪心
动态规划
贪心
ZOJ1025 Wooden
Sticks
题目:DescriptionThereisapileofnwoodensticks.Thelengthandweightofeachstickareknowninadvance.Thesticksaretobeprocessedbyawoodworkingmachineinonebyonefashion.Itneedssometime,calledsetuptime,forthemachineto
codeTZ
·
2016-02-13 13:00
动态规划
ZOJ
贪心
1025
UVA - 1401 Remember the Word trie+DP
RemembertheWordSinceJiejiecan’tremembernumbersclearly,hejustusesstickstohelphimself.AllowingforJiejie’sonly20071027
sticks
zxhl
·
2016-02-12 21:00
LightOJ 1342 Aladdin and the Magical
Sticks
[想法题]
题目链接:http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=27050------------------------------------------------------------------------------------------------------------我们先考虑这个问题有一堆牌其中$n$张牌抽到
sagitta
·
2016-02-11 00:00
HDU 1147 Pick-up
sticks
(叉乘判断线段相交)
Pick-upsticksTimeLimit:4000/2000MS(Java/Others) MemoryLimit:65536/32768K(Java/Others)TotalSubmission(s):2624 AcceptedSubmission(s):954ProblemDescriptionStanhasnsticksofvariouslength.Hethrowsthem
Strokess
·
2016-02-07 21:00
Lengthening
Sticks
(数学)
题意:给定1≤a,b,c≤2×105,现有0≤l≤3×105的长度向a,b,c添加,可以为0,可以最终有剩余求新的a′,b′,c′形成不退化的三角形的方法数分析:首先,逆向思考,用总的−退化的三角形的方法数total=C3l+3,如何理解呢,原来是将L长度分成4份,每份可以为0现在是将L+4长度分成4份,每份至少为1,用隔板法即可得出结果(Ck−1n−1)显然我们为求退化的方法数,要枚举最长边令添
lwt36
·
2016-02-04 18:00
数学
UVA10003 - Cutting
Sticks
用dp(i,j)表示木棍在i切割点和j切割点之间的最小费用状态转移方程:dp(i,j)=min(dp(i,j),dp(i,h)+dp(j,h)+num[j]-num[i]);#include #include #include #include usingnamespacestd; #defineINF1>l&&l) { cin>>n; for(inti=1;i<=n;i++) scanf("
qq_26122039
·
2016-02-04 13:00
poj Pick-up
sticks
(判断线段相交)
Pick-upsticksTimeLimit:3000MS MemoryLimit:65536KTotalSubmissions:11537 Accepted:4337DescriptionStanhasnsticksofvariouslength.Hethrowsthemoneatatimeonthefloorinarandomway.Afterfinishingthrowing,Stantr
hahalidaxin
·
2016-02-03 11:00
poj Pick-up
sticks
(判断线段相交)
Pick-upsticksTimeLimit:3000MS MemoryLimit:65536KTotalSubmissions:11537 Accepted:4337DescriptionStanhasnsticksofvariouslength.Hethrowsthemoneatatimeonthefloorinarandomway.Afterfinishingthrowing,Stantr
hahalidaxin
·
2016-02-03 11:00
HDU 1051:Wooden
Sticks
【贪心】
WoodenSticksTimeLimit:2000/1000MS(Java/Others) MemoryLimit:65536/32768K(Java/Others)TotalSubmission(s):16237 AcceptedSubmission(s):6665ProblemDescriptionThereisapileofnwoodensticks.Thelengthandw
lin14543
·
2016-02-03 10:00
poj 1065 Wooden
Sticks
【贪心】
WoodenSticksTimeLimit: 1000MS MemoryLimit: 10000KTotalSubmissions: 20341 Accepted: 8582DescriptionThereisapileofnwoodensticks.Thelengthandweightofeachstickareknowninadvance.Thesticksaretobeprocessedby
liu6886
·
2016-01-25 21:00
poj 2513 Colored
Sticks
字典树+并查集+欧拉路
题意:给出n对筷子,每对筷子两端都有颜色,不同筷子相同颜色的一端可以连在一起。问是否能让所有筷子连成一条线段。分析:一开始我的想法是把每种颜色的数量统计起来,若数量为单数的颜色>=3或=1则Impossible,反之则Possible。但后来我发现我错了,反例:red,green;blue,blue。然后看了别人的题解才发现是要先构图再用欧拉路(一笔画问题)来判断。构图的方法为每种颜色为一个点,一
qq_33229466
·
2016-01-22 07:00
poj-2513-Colored
Sticks
-字典树trie / hash +并查集 欧拉回路
http://poj.org/problem?id=2513 ..........一看到题。。试着用hash水一下。。wa用map水一下TLE。。好吧。。trie试一下。。。wa.wa.wa.....好吧。。最后发现是自己傻逼了。。。 窝一开始犯了傻逼错误,以为直接计算颜色出现的种数。。。奇数个数的颜色为0或2就合法。。然而这只是必要条件.....不是充分条件...........
viphong
·
2016-01-17 22:00
hdoj--1051--Wooden
Sticks
(LIS)
WoodenSticksTimeLimit:2000/1000MS(Java/Others) MemoryLimit:65536/32768K(Java/Others)TotalSubmission(s):15987 AcceptedSubmission(s):6564ProblemDescriptionThereisapileofnwoodensticks.Thelengthandw
qq_29963431
·
2016-01-13 15:00
POJ 2452
Sticks
Problem(ST+二分查找)
Description给出一长度为n的序列,序列没有重复的数值,问j-i的最大值,其中j,i满足a[i] #include #include #include #include usingnamespacestd; #definemaxn55555 #defineINF0x3f3f3f3f intn,a[maxn],sta[maxn],p,smax[maxn][22],smin[maxn][22]
V5ZSQ
·
2016-01-05 17:00
欧拉路径 之 poj 2513 Colored
Sticks
/*欧拉路径 之 poj 2513 Colored
Sticks
欧拉路径: 若图G中存在这样一条路径,使得它恰通过G中每条边一次,则称该路径为欧拉路径。
JmingS
·
2016-01-04 16:00
POJ 1065 Wooden
Sticks
(LIS)
WoodenSticksTimeLimit: 1000MSMemoryLimit: 10000KTotalSubmissions: 20291Accepted: 8556DescriptionThereisapileofnwoodensticks.Thelengthandweightofeachstickareknowninadvance.Thesticksaretobeprocessedbyaw
zwj1452267376
·
2016-01-03 17:00
hdu1455
Sticks
【深搜剪枝】
又是卡了3天的题,终于结束了,也是怪中己太不细心==和上一篇博客之中做的点击打开链接 hdu1518拼正方形类似,这个题开始就一直超时,开始以为是只带入了一个表示木棍长度的参数,根数每次都算导致的,然而发现了小木棍不一定长度不同,所以应该加一个while循环去掉之前算过不满足条件的,而且如果发现有最长的木棍情况下,最长的在深搜之中始终用不上,那么一定需要删除这种情况!犯二的地方:题解说while(
zhou_yujia
·
2015-12-16 14:00
搜索
HDU
【Codeforces Round 269 (Div 2)C】【暴力】MUH and
Sticks
纸牌搭楼n张牌恰好搭楼数
C.MUHandHouseofCardstimelimitpertest1secondmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputPolarbearsMenshykovandUsladafromthezooofSt.PetersburgandelephantHoracefromthezooofKievdec
snowy_smile
·
2015-12-11 09:00
codeforces
暴力
题库-CF
【Codeforces Round 269 (Div 2)B】【简单构造】MUH and
Sticks
数值升序输出三种可能编号序
B.MUHandImportantThingstimelimitpertest1secondmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputIt'stimepolarbearsMenshykovandUsladafromthezooofSt.PetersburgandelephantHoracefromthez
snowy_smile
·
2015-12-11 09:00
codeforces
构造
题库-CF
【Codeforces Round 269 (Div 2)A】【简单讨论】MUH and
Sticks
6根木棍拼动物
MUHandStickstimelimitpertest1secondmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputTwopolarbearsMenshykovandUsladafromtheSt.PetersburgzooandelephantHoracefromtheKievzoogotsixsticks
snowy_smile
·
2015-12-11 08:00
水题
codeforces
讨论
题库-CF
poj 1011
Sticks
经典的深搜(dfs)+ 强剪枝
SticksTimeLimit:1000MS MemoryLimit:10000KTotalSubmissions:131671 Accepted:30906DescriptionGeorgetooksticksofthesamelengthandcutthemrandomlyuntilallpartsbecameatmost50unitslong.Nowhewantstoreturnsticks
qiuxueming_csdn
·
2015-12-07 20:00
欧拉路+字典树 poj2513 Colored
Sticks
这题真卡空间==这道题就是判断是否图中有欧拉路,判断图是否联通欧拉路:图中度数为奇数的点为0或者2判断图是否连通,直接dfs遍历一次图就行了但是这道题输入的是25wstring用map会t的我们要用到字典树我的字典树模板intnewnode(){ for(inti=0;i #include #include #include #include #include #include #include
meixiuxiudd
·
2015-12-04 15:00
字典树
欧拉路
Lengthening
Sticks
(组合+容斥)
之前也遇到过好几次这种类型的题目了,但是这次还是没有在比赛中做出来。因为输入只有4个数,可变化的状态很少,但是数据范围又很大,所以不可能是DP之类的,一定是一道数学题。 这种特点的题目我们很容易想到排列组合,然而排列组合往往又会带来重复计数的问题,所以往往这类题目又需要夹杂容斥定理,可以说是约定俗称的题目类型。那么不难想到,用总的组合情况减去不成立的情况(不成立的情况往往好求)。 对于总的情况,我
weizhuwyzc000
·
2015-11-25 19:00
排列组合
ACM-ICPC
容斥定理
UESTC 1218 Pick The
Sticks
(dp )
http://acm.uestc.edu.cn/#/problem/show/1218题目:一根长为m的长木板和一些小木棒,每一根小木棒有它的长度和价值,这些小木棒要放在长木板上并且每一根小木棒的重心要在长木板上(可以露出一半的长),最大价值是多少。让人联想到01背包,但是又有些许的不同。#include #include #include #include usingnamespacestd;
theArcticOcean
·
2015-11-25 11:00
dp
HDOJ 1051 Wooden
Sticks
(LIS)
WoodenSticksTimeLimit:2000/1000MS(Java/Others) MemoryLimit:65536/32768K(Java/Others)TotalSubmission(s):15700 AcceptedSubmission(s):6451ProblemDescriptionThereisapileofnwoodensticks.Thelengthan
zwj1452267376
·
2015-11-22 20:00
CodeForces 525C Ilya and
Sticks
排序后从大到小扫一遍。cf竟然不支持%lld?#include #include intmain(){ staticlonglonga[100005]; intn,i;longlongx,ans; scanf("%d",&n); for(i=1;i=1;i--) if(a[i+1]-a[i]<2){ if(x)ans+=x*a[i],x=0; elsex=a[i]; i--; } printf("
huanghongxun
·
2015-11-15 22:00
poj1011
Sticks
传说中的poj必做50题之中的一个…… 这是个传说中的搜索, 一開始以为, 仅仅要棒子加起来等于如果的原始长度, 那么这几根选择的棒子就不用管了, 结果卡在第一个例子…… 看了一下,发现, 代码把1,2,1,2合成一个棒子, 这样其它就凑不成3根长度为6的棒子了, 写了半天,发现思路错了, 这个问题不知道怎样解决。 參考了下面地址的结题报告: http://blog.csd
·
2015-11-13 21:16
poj
ZOJ 1025 Wooden
Sticks
(DP)
problemCode=1025 如果我们定义在一个
sticks
序列中,对所有的 j>i 均满足 :
sticks
[i].l>=
sticks
[j].l 且
sticks
·
2015-11-13 18:13
ZOJ
poj 1011
Sticks
Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 69843 Accepted: 15257 本题对本人来说有点小难啊,交了n次都是tle后来看了别人的代码才知道加了一句剪枝,但这一句话是什么意思,我到现在也没看懂,如果哪位大牛看到此随笔,麻烦给我也解释一下。能举出例子最好! 代码:
·
2015-11-13 17:12
poj
上一页
1
2
3
4
5
6
7
8
下一页
按字母分类:
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
其他