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
POJ 2513 Colored
Sticks
(欧拉回路,字典树,并查集)
Colored
Sticks
Time Limit: 5000MS Memory Limit: 128000K Total Submissions: 24748  
·
2015-10-31 10:26
color
HDU 3573 Buy
Sticks
(数学规律)
Buy
Sticks
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K
·
2015-10-31 10:25
HDU
Colored
Sticks
(彩色棒)
poj 2513 题目大意:给一些彩色棒,看能不能组成一个 解决:trie+无向图欧拉路(偶数结点度数为0或者2) clude <iostream> #include <cstring> #include <cstdio> using namespace std; struct node { int next[26];
·
2015-10-31 10:29
color
poj1011
Sticks
Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 95592
·
2015-10-31 09:01
poj
HDU-1455
Sticks
dfs+剪枝
该题与上题相比增加了多种分法,而不只是四条边,问题是最多能够分成多少条边。 上题代码其实错了(已改),但是也过了,这题改的还纠结。 代码如下: #include <cstdlib> #include <cstdio> #include <cstring> #include <algorithm> using namespace std
·
2015-10-31 09:14
HDU
SPOJ 3937 - Wooden
Sticks
最长上升子序列LIS
给了n个(n<=5000)木棍的长度hi与宽度wi(均小于10000),现在机器要打磨这些木棍,如果相邻连个木棍hi<=hj并且wi<=wj就不需要调整机器,问如何排序使得机器调整的次数最少。 【LIS】基本上和【这题】相同,但是那题中,如果hi=hj并且wi=wj长度会增加,而这道题则相反。 还是类似于那一题的思路: 假设wi>wj,
·
2015-10-31 09:32
poj
Careercup - Google面试题 - 4557716425015296
2014-05-03 21:57 题目链接 原题: Many
sticks
with length, every time combine two, the cost is the sum of
·
2015-10-31 09:22
Google
POJ 1011/DFS:子集划分
问题描述:原有若干
sticks
,每支stick被分割成若干支,现在要恢复一下。
·
2015-10-31 09:27
poj
POJ 2362/DFS:判断是否能形成正方形
#include <iostream> #include <algorithm> using namespace std; #define MAX 64 int
sticks
·
2015-10-31 09:27
poj
[欧拉] poj 2513 Colored
Sticks
id=2513 Colored
Sticks
Time Limit: 5000MS Memory Limit: 128000K Total
·
2015-10-30 15:42
color
POJ1011
Sticks
Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 100068
·
2015-10-30 14:25
poj
hdu1051 Wooden
Sticks
题目:http://acm.hdu.edu.cn/showproblem.php?pid=1051 大意:求最少升序序列的个数。 #include <cstdio> #include <cstring> #include <algorithm> #define N 5000 + 5 using namespace s
·
2015-10-30 14:51
HDU
POJ-2513 Colored
Sticks
字典树,欧拉回路
这题用map就超时了,所以用字典树来优化,第一次写静态的,现在都不习惯用指针了。 由于这里不要回到源点,所以不许要所有点的度都为偶数,零个或者两个均可,图也必须是连通的。 代码如下: #include <cstring> #include <cstdlib> #include <cstdio> #include <string> us
·
2015-10-30 14:20
color
POJ1011———
Sticks
/*dfs,剪枝是关键。╮(╯▽╰)╭本来是想一根棍子 一个棍子的填充,遇到棍子不合适的就回溯。但是实验 证明这绝对是剪错方向的!正确的解法是。。。先寻找 第一根棍子合不合适,如果不合适就没有必要找下去了, 这是关键点。这题堪称剪枝之最啊~~~~~ */ #include<cstdio> #include<cstring> #include<alg
·
2015-10-30 13:38
poj
UVA 10003 Cutting
Sticks
UVA_10003 这是个区间的动态规划问题,首先我们可以补两个端点,然后就按区间长度递增的顺序进行递推即可,区间长度为1时的花费要初始化成0,其余初始化为INF。 转移方程为f[i, j] = min{f[i, k] + f[k, j] + a[j] – a[i]}(i < k < j)。 #include<std
·
2015-10-30 13:55
uva
Ilya and
Sticks
贪心
Ilya and
Sticks
Time Limit: 2 Sec Memory Limit: 256 MB Submit: xxx Solved: 2xx 题目连接
·
2015-10-30 13:20
codeforces
NYOJ 293
Sticks
Sticks
时间限制: 3000 ms | 内存限制:65535 KB 难度: 5 描述 George
·
2015-10-28 08:56
OJ
POJ-2563
Pick-up
sticks
Time Limit: 3000MS Memory Limit: 65536K Total Submissions: 10364  
·
2015-10-28 08:38
poj
南阳ccpc D题 Pick The
Sticks
PickTheSticksTimeLimit:15000/10000MS(Java/Others) MemoryLimit:65535/65535KB(Java/Others)Submit StatusThestoryhappenedlonglongago.Oneday,CaoCaomadeaspecialordercalled"ChickenRib"tohisarmy.Noonegothis
dml_96
·
2015-10-27 20:00
POJ1065
Wooden
Sticks
Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 
·
2015-10-27 15:02
poj
UVAlive 2322 (13.08.23)
There is a pile of n wooden
sticks
. The length and weight ofeach stick are known in advance.
·
2015-10-27 15:00
live
(step4.3.10)hdu 1455(
Sticks
——DFS)
题目大意: 经典深搜 给你若干根短棒,将其组合成等长的木棒,尽可能短 ,并输出其长度 代码如下: /* * 1455_3.cpp * * Created on: 2013年8月23日 * Author: Administrator */ #include <iostream>
·
2015-10-27 15:53
HDU
Wooden
Sticks
(hdu1501)(sort,dp)
Wooden
Sticks
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (
·
2015-10-27 14:46
sort
每日英语:Lighting: Twigs Shine in Home Decor
The
sticks
suggest rustic luxury -- think barn weddings and ski resorts -- but can also be found in modern
·
2015-10-27 14:45
home
POJ 1011
Sticks
dfs,剪枝 难度:2
http://poj.org/problem?id=1011 要把所给的集合分成几个集合,每个集合相加之和ans相等,且ans最小,因为这个和ans只在[1,64*50]内,所以可以用dfs一试 首先ans需要满足两个条件1.可以被总集合的和sum整除 2.是总集合的某个子集的和 对于条件1,可以通过试除遍历 对于条件2,可以通过dp预筛选,这两个花费时间都不大 接着搜索能不能划分成集合之和
·
2015-10-27 14:49
poj
HDU1698:Just a Hook(线段树区间更新)
The hook is made up of several consecutive metallic
sticks
which are of the sam
·
2015-10-27 13:11
HDU
ZOJ1025 Wooden
Sticks
典型的贪心算法,和前面1029一样也是工作时间调度问题。 #include < iostream > #include < vector > #include < algorithm > using namespace std; const int
·
2015-10-23 09:48
ZOJ
POJ 1011
Sticks
Sticks
Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 106254
·
2015-10-23 08:13
poj
poj2513Colored
Sticks
(无向图的欧拉回路)
1 /* 2 题意:将两端涂有颜色的木棒连在一起,并且连接处的颜色相同! 3 思路:将每一个单词看成一个节点,建立节点之间的无向图!判断是否是欧拉回路或者是欧拉路 4 5 并查集判通 + 奇度节点个数等于2或者0 6 */ 7 #include<cstring> 8 #include<cstdio> 9 #inc
·
2015-10-23 08:06
color
POJ 2362 Square
Description Given a set of
sticks
of various lengths, is it possible to join them end-to-end to form
·
2015-10-23 08:56
poj
poj 2653 Pick-up
sticks
#include<stdio.h> #include<math.h> #include<string.h> #define eps 1e-8 #define zero(x)(((x)>0 ? (x):(-x))<eps) struct Point { double x,y; }; struct Line { Po
·
2015-10-23 08:36
poj
HDU-1051Wooden
Sticks
--贪心
Wooden
Sticks
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768
·
2015-10-21 12:18
HDU
POJ-1011
Sticks
Sticks
Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 99807 Accepted
·
2015-10-21 12:06
poj
sticks
---经典的搜素题目
题目大意:有一些长度相同的木棒,被切成一些小快,每块不超过50个单位长度,现在想拼成原来的样子,并且希望拼成的样子最短。 思路: 深搜+剪枝 减枝技巧: 1.最长的木棍的长度一定不会超过以前的木棍长度,所以从最长的长度开始枚举 2.如果总长度不能被选中的长度整除剪掉 3.如果所求木棍数等于总长度除以所枚举的木棍长度返回,不要再向下搜索 4.每加入一个木棍做一下标记,以免被再次搜索 5
·
2015-10-21 11:42
c
HDU_1455 && POJ_1011
Sticks
(dfs)
代码+注释: #include <iostream>#include <cstdio>#include <algorithm>using namespace std;const int N = 100;int s[N];bool used[N];int cmp(int a, int b){ return a > b;}bool dfs(int n
·
2015-10-21 11:46
poj
HDU_1051 && POJ_1065 Wooden
Sticks
(贪心)
典型的贪心题目,做过很久了,今天复习贪心,回头看了看,顺便把报告补上。 我的思路是做一个标记变量flag和一个计算的变量k(k = n),flag初始为0, 每次找一个满足(l <= l' && w <= w' && !flag)的序列,并将序列元素的flag标为1, 总序列就会减少一个数所以k--,找完一个序列,结果ans++。
·
2015-10-21 11:44
poj
UVA 307
Sticks
UVA_307 相当于重温了一下POJ 1011这个题目,剪枝在这个题目中显得尤为重要。 对于这道题而言,剪枝的策略一般有下面6个: ①先将木棒长度从大到小进行排序,这样便于后面的选择和操作,是后面一些剪枝算法的前提。 ②在枚举原木棒长度时,枚举的范围为max与sum/2之间,如果这个区间内没有找到合适的长度,那么最后原木棒的长度只能是sum。 ③枚举的原木棒的长度只能是sum
·
2015-10-21 10:35
uva
POJ 1011
Sticks
POJ_1011 做完这个题目,让我不仅学到了一些别人剪枝的策略,更重要的是让我意识到了在搜索中剪枝的重要性。 所谓剪枝,其实就是对程序的优化,尽可能地避免程序执行无用的操作。就这个题目而言,程序的优化主要有以下几个方面: ①我们在拼木棒之前应该对木棒最长到短进行排序,这样方便我们后面挑选木棒的操作,因为如果前面先拼短木棒的话,很有可能后面任何一根木棒都不能填补剩余的长度,而先拼长木棒
·
2015-10-21 10:17
poj
programming-challenges Cutting
Sticks
(111105) 题解
和算法导论中动态规划章节中计算矩阵相乘最小代价是一样的解题思路。稍有的一次ac,所以难度只到2吧。#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #includ
houhouzhe
·
2015-10-19 19:00
Algorithm
C++
动态规划
hdoj 1051 Wooden
Sticks
WoodenSticksTimeLimit:2000/1000ms(Java/Other) MemoryLimit:65536/32768K(Java/Other)TotalSubmission(s):8 AcceptedSubmission(s):5Font:TimesNewRoman|Verdana|GeorgiaFontSize:←→ProblemDescriptionThereis
mr_fan_123
·
2015-10-19 09:00
hdoj
HDU 3573 Buy
Sticks
贪心--利用率
题意:有20,28,32cm长的棒子,是我需要的,现在商店只有75cm长的棒子,现在要把75cm的棒子截成那三个长度的棒子(不能拼凑,不能用10cm+10cm=20cm类似),问你至少需要多少棒子。思路:我又是被利用率的贪心给虐了。这下要长一点记性了,来看这题。首先,我当然我希望75cm的棒子剩下的废料越少越好,那么最好的组合当然是3个短的棒子,其中rate最高的是top1:202032,其次to
Triple_WDF
·
2015-10-05 18:00
贪心利用率
hd1051 Wooden
Sticks
WoodenSticksTimeLimit:2000/1000MS(Java/Others)MemoryLimit:65536/32768K(Java/Others)TotalSubmission(s):15221AcceptedSubmission(s):6246ProblemDescriptionThereisapileofnwoodensticks.Thelengthandweightofe
GuoZLH
·
2015-10-03 12:00
Lengthening
Sticks
-组合数学
给你a,b,c木棒的长度,给你一个额外长度L你可以给abc随意增加长度xyz(x+y+z《L,xyz可为0)使得abc构成一个三角形 首先,枚举合法的三角形肯定是超时的,正难则反,那么我们可以先计算出总共的方案数,以及不合法的三角形方案数,相减便是合法的了; 1、首先枚举你增加了的总长度为j (一定增加了j,不多不少), j范围是0到L对每一个j,都有 方案数+=(j+1)(j+2)/2;
viphong
·
2015-09-26 10:00
POJ 1011
Sticks
(深搜+强剪枝)
题意:给你很多短的棒子,它们的长度告诉你,它们是由很多根长的棒子截出来的,问你这些短的棒子可以组成很多个相等的长棒子,求单个长棒子最短是多少?想法:设所有棒子的总长为sum,seglen为单个长棒子的长度。通过题意,你需要知道当前seglen还有多少?sum还有多少可以用。剪枝:1.seglen必定不小于所有短木棒里面最长的那个。 2.seglen的长度肯定能被sum整除。
Triple_WDF
·
2015-09-25 00:00
搜索
571A Lengthening
Sticks
timelimitpertest1secondmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputYouaregiventhreestickswithpositiveintegerlengthsof a, b,and c centimeters.Youcanincreaselengthofsomeofthembys
Kirito_Acmer
·
2015-09-18 17:00
codeforces
Codeforces Round #317 A.Lengthening
Sticks
题目链接题意:给出a,b,c,L,要求a+x,b+y,c+z构成三角形,x+y+z#include#include#includeusingnamespacestd;constintN=1e5+10;typedeflonglongll;lla,b,c,l,maxn;llsol(llx,lly,llz){lltmp=0;for(lli=x;i<=x+l;i++){if((y+z)<=i){llcnt
龟大仙
·
2015-09-03 19:02
容斥
POJ 2513 Colored
Sticks
(Trie树,欧拉通路,并查集)
DescriptionYouaregivenabunchofwoodensticks.Eachendpointofeachstickiscoloredwithsomecolor.Isitpossibletoalignthesticksinastraightlinesuchthatthecolorsoftheendpointsthattouchareofthesamecolor?InputInput
Misdom_Tian_Ya
·
2015-08-27 16:00
Lengthening
Sticks
分类
A.LengtheningStickstimelimitpertest1secondmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputYouaregiventhreestickswithpositiveintegerlengthsof a, b,and c centimeters.Youcanincreasele
u010422038
·
2015-08-26 17:00
HDU 1051.Wooden
Sticks
【贪心】【8月26】
WoodenSticksProblemDescriptionThereisapileofnwoodensticks.Thelengthandweightofeachstickareknowninadvance.Thesticksaretobeprocessedbyawoodworkingmachineinonebyonefashion.Itneedssometime,calledsetuptime
a995549572
·
2015-08-26 13:00
C++
ACM
HDU
贪心算法
HDU 1051 Wooden
Sticks
(贪心)
ProblemDescriptionThereisapileofnwoodensticks.Thelengthandweightofeachstickareknowninadvance.Thesticksaretobeprocessedbyawoodworkingmachineinonebyonefashion.Itneedssometime,calledsetuptime,forthemachi
Misdom_Tian_Ya
·
2015-08-25 14:00
上一页
5
6
7
8
9
10
11
12
下一页
按字母分类:
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
其他