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
Hardwood
POJ 2418
Hardwood
Species Trie树模板
恩恩,好久不写Blog了这次是我的首个Trie树,例题是POJ2418,次元传送门在这里题意:输入若干个字符串,注意中间可能带有空格哈(就是说不要用cin之类的了,用gets()就好),请你统计一下每一种字符串的出现频率(就是出现次数/总字符串数),并按字典序依次输出这些归并后的字符串并输出百分比形式的频率。分析:嘛嘛,感觉此题解法很不唯一啊,不过是来联系Trie树的是不是,老老实实学模板吧。那么
YOUSIKI
·
2016-04-21 10:00
SGC 131
Hardwood
floor
HardwoodfloorTimeLimit:250MS MemoryLimit:4096KB 64bitIOFormat:%I64d&%I64uSubmitStatusPracticeSGU131Appointdescription:DescriptionThebanquethallofComputerScientists'Palacehasarectangularformofthe
zjw6463
·
2016-03-01 19:00
poj_2418
Hardwood
Species (字典序Trie树)
又是一道典型的Trie树应用题,有了Trie树的基本知识,写起来就非常容易了~~【题目描述】Hardwoodsarethebotanicalgroupoftreesthathavebroadleaves,produceafruitornut,andgenerallygodormantinthewinter. America'stemperateclimatesproduceforestswithh
cleopard66
·
2016-01-27 18:00
数据结构
算法
Trie树
字典树
NOI
POJ 2418
Hardwood
Species( AVL-Tree )
#include <stdio.h> #include <stdlib.h> #include <math.h> #include <string.h> typedef struct AVLTree{ char name[31]; int nCount; int nHeight; struct AVL
·
2015-11-13 22:06
tree
A过的题目
1.TreeMap和TreeSet类:A - Language of FatMouse ZOJ1109B - For Fans of Statistics URAL 1613 C -
Hardwood
·
2015-11-13 16:59
a
poj 2418
Hardwood
Species(字典树)
求出该字符窜在所有字符窜中德比例 Trie树,这次学到了如何输出 View Code 1 #include<stdio.h> 2 #include<string.h> 3 #include<stdlib.h> 4 5 const int MAXN=256; 6 7 struct Trie 8 { 9 T
·
2015-11-13 16:16
poj
poj2418
Hardwood
Species
编辑器加载中... 题目: 给出一些树名,问每一棵树的所占的比例 分析: 就是给树按字典序排序,并输出他们所占的比例,由于本题涉及的树名比较多,可以采用 二分搜索树来做
·
2015-11-13 03:54
poj
几道字典树题目
POJ 2418
Hardwood
Species 题意:给一些字符串,按照字典序输出他们,并且输出频率...........
·
2015-11-13 02:04
字典树
POJ 2418
Hardwood
Species【二叉查找树】
POJ 2418
Hardwood
Species算法核心 二叉查找树题目大意:通过卫星得到了某一个区域的树名,将这些树名按字典顺序输出,并输出在树的总数中所占的比例,保留小数点后四位。
·
2015-11-12 22:16
二叉查找树
POJ2418
Hardwood
Species(字典树+字符串排序)
题目大意:给一个字符文本,每行一个字符串,统计不同的字符串出现的百分比。最后按ASCII排序输出不同字符串和出现的百分比。 分析:对输入字符串建立字典树,在叶子结点记录该字符串出现的次数。这样的话,最后就可以查找每个字符串出现的次数。另外用一个数组记录不同的字符串,然后对其排序,输出结果。 建字典树时要注意,题中没说出现的字符的范围,那就是所有字符都可能出现。数组应开成next[NODE][1
·
2015-11-12 19:26
字符串
poj2418
Hardwood
Species
http://poj.org/problem?id=2418 trie树,有非空格、字母的字符 View Code 1 #include <iostream> 2 #include<cstdio> 3 #include<cstring> 4 #include<stdlib.h> 5 #include<algor
·
2015-11-12 18:52
poj
POJ 2418
Hardwood
Species(trie 树)
题目链接 开始想用map的,字典序不会搞,还是老老实实的用trie树把。好久没写了,忘得差不多了。 1 #include <iostream> 2 #include <cstdio> 3 #include <cstdlib> 4 #include <cstring> 5 #include <map> 6 #in
·
2015-11-12 09:49
trie
状态压缩dp/sgu 131
Hardwood
floor
题意 给出一个n*m的格子,要求用1*2的块和2*2缺一角的块填满,求方案数 分析 状压dp,以下来自nocow: 状态压缩DP,转移的时候情况很多,要一个个写出来理清楚再写。 一行一行推,opt1为上一行的状态,opt2为当前行的状态,u1,u2分别为上下两行是否与左边相连而凸出来。 /* Case 1
·
2015-11-11 18:58
OO
Hardwood
Species
http://poj.org/problem?id=2418 1 #include<cstdio> 2 #include<cstring> 3 #include<string> 4 #include<iostream> 5 #include<map> 6 #include<algorithm>
·
2015-11-11 13:48
IE
poj 2418
Hardwood
Species
http://poj.org/problem?id=2418 题意:给定一些树,按字典序输出数名和树出现的频率; 思路:这个题用二叉搜索树可以做,同时在网上看到了一个简单的方法,用map来做,这里map真是太好用了; map做法: View Code #include <iostream>#include <map>#include <cstdio&
·
2015-11-11 12:19
poj
SGU131 -
Hardwood
floor(状态压缩DP)
题目大意 给定一个N*M大小的矩形,要求你用1*2和2*2(缺个角)的砖块把矩形铺满(不能重叠),问总共有多少种铺法? 题解 受POJ2411的影响,怎么都没想到3,4,5,6这几种情况该怎么放置,看了网上大牛的解题报告和代码(真是不好的习惯,可是太弱了就是想不出咋办%>_<%)之后豁然开朗~~~~ 规模比较小,所以用状态压缩DP来搞,是POJ2411加强版。有以下几种铺法:
·
2015-11-11 12:41
OO
POJ2418
Hardwood
Species
题意 : 输入若干个树木品种,里边有的是重复的,让你统计每个品种占输入的总数量的百分比,最后按字典序输出 思路 : 本题数量很大,所以采用直接统计的方式会超时,而采用的方法可以用二叉搜索树,或者用map函数或者是字典树都可以实现,呃,我想说,为什么用G++交WA了,得用C++交才对啊 #include<cstdio> #include<cstring> #i
·
2015-11-11 10:09
poj
POJ 之
Hardwood
Species
nbsp;
Hardwood
·
2015-11-11 00:08
poj
poj 2418
Hardwood
Species
原题链接:http://poj.org/problem?id=2418 简单题。。 平衡树,写了个模板。。动态分配内存确实很慢。。。 1 #include<algorithm> 2 #include<iostream> 3 #include<string> 4 #include<cstdlib>
·
2015-11-07 15:18
poj
POJ 2418
Hardwood
Species【字典树 / map】
题意:统计树的种类出现的百分率,给你树木的名字(可能有重复,最多100W个数据,种类不超过1W),数目名字的长度不超过30,但是可能包含空格,也可能包含别的字符(所以需要把struct开到ch[130],RE被坑了多次,最终AC)用字典树做或者是用map,目前只做了字典树版本的,以后map填坑。。HardwoodSpeciesTimeLimit: 10000MS MemoryLimit: 6553
wxyfennie
·
2015-11-06 17:00
poj 2418
Hardwood
Species 字典树
HardwoodSpeciesDescriptionHardwoodsarethebotanicalgroupoftreesthathavebroadleaves,produceafruitornut,andgenerallygodormantinthewinter.America'stemperateclimatesproduceforestswithhundredsofhardwoodspec
wr132
·
2015-11-06 15:00
poj
字典树
Hardwood
Species
2418
Hardwood
Species
Description Hardwoods are the botanical group of trees that have broad leaves, produce a fruit or nut, and generally go dormant in the winter. America's temperate climates produce forests with hund
·
2015-11-06 07:25
IE
POJ2418
Hardwood
Species(Tire树)
DescriptionHardwoodsarethebotanicalgroupoftreesthathavebroadleaves,produceafruitornut,andgenerallygodormantinthewinter.America’stemperateclimatesproduceforestswithhundredsofhardwoodspecies–treesthatsh
zyd8888102
·
2015-11-05 19:00
poj
Hardwood
Species(水)
TimeLimit:10000MS MemoryLimit:65536KB 64bitIOFormat:%I64d&%I64uSubmitStatusDescriptionHardwoodsarethebotanicalgroupoftreesthathavebroadleaves,produceafruitornut,andgenerallygodormantinthewinter.
u014665013
·
2015-11-04 19:00
poj2418(
Hardwood
Species)
思路:建立Tire树,dfs一遍,再del下。//#pragmacomment(linker,"/STACK:1024000000,1024000000") #include #include #include #include #include #include #include #include #include #include #include #include #include #inc
KIJamesQi
·
2015-11-02 22:00
pku 2418
Hardwood
Species 字典树
http://poj.org/problem?id=2418 字典数编号,统计每个单词出现的次数,然后计算频率: View Code #include <iostream>#include <cstdio>#include <cstring>#include <cmath>#include <algorithm>#defin
·
2015-11-01 14:35
pku
poj 2418
Hardwood
Species(Trie树)
HardwoodSpeciesTimeLimit:10000MS MemoryLimit:65536KB 64bitIOFormat:%I64d&%I64uDescriptionHardwoodsarethebotanicalgroupoftreesthathavebroadleaves,produceafruitornut,andgenerallygodormantinthewi
u014552756
·
2015-10-31 23:00
POJ 2418 ,ZOJ 1899
Hardwood
Species - from lanshui_Yang
Description Hardwoods are the botanical group of trees that have broad leaves, produce a fruit or nut, and generally go dormant in the winter. America's temperate climates produce forests wit
·
2015-10-31 12:09
poj
Hardwood
floor 状压dp 难度:2
Hardwood
floor time limit per test: 0.25 sec.
·
2015-10-31 09:36
OO
SGU 131.
Hardwood
floor
时间限制:0.25s 空间限制:4M 题意: 给出 n*m (1≤n、m≤9)的方格棋盘,用 1*2 的矩形的骨牌和 L 形的(2*2 的 去掉一个角)骨牌不重叠地覆盖,求覆盖满的方案数。 Solution:
·
2015-10-31 09:27
OO
poj2418
Hardwood
Species
1 import java.util. * ; 2 import java.io. * ; 3 import java.text. * ; 4 5 public class Main 6 { 7
·
2015-10-29 08:29
poj
POJ2418----
Hardwood
Species
HardwoodSpeciesTimeLimit:10000MS MemoryLimit:65536KTotalSubmissions:20874 Accepted:8186统计每个单词出现的频率;可以用map水过!DescriptionHardwoodsarethebotanicalgroupoftreesthathavebroadleaves,produceafruitornut,andgen
lv414333532
·
2015-08-24 16:00
Hardwood
Species POJ 2418
HardwoodSpeciesTimeLimit:10000MS MemoryLimit:65536KTotalSubmissions:20816 Accepted:8163DescriptionHardwoodsarethebotanicalgroupoftreesthathavebroadleaves,produceafruitornut,andgenerallygodormantinthew
JSPang
·
2015-08-20 21:00
POJ 2418
Hardwood
Species
题目链接:http://poj.org/problem?id=2418解题思路:按字典序输出,每种树占所有树的百分比。。。首先用字典树存所有树,再用dfs进行搜索,就可以很轻松解决每种树的数量了。。。同样map也可以轻松解决。。。不过时间效率相对有点低而已。。。AC代码(map):#include #include #include #include #include usingnamespace
piaocoder
·
2015-08-17 20:00
字典树
POJ 2418
Hardwood
Species (trie树\map)
DescriptionHardwoodsarethebotanicalgroupoftreesthathavebroadleaves,produceafruitornut,andgenerallygodormantinthewinter. America'stemperateclimatesproduceforestswithhundredsofhardwoodspecies--treesthat
Misdom_Tian_Ya
·
2015-08-15 19:00
POJ 2418
Hardwood
Species (字典树||MAP)
HardwoodSpeciesTimeLimit:10000MS MemoryLimit:65536KTotalSubmissions:20684 Accepted:8108DescriptionHardwoodsarethebotanicalgroupoftreesthathavebroadleaves,produceafruitornut,andgenerallygodormantinthew
Grit_ICPC
·
2015-08-12 11:00
STL
trie
Hardwood
Species
HardwoodSpeciesTimeLimit:10000MSMemoryLimit:65536KTotalSubmissions:20619Accepted:8083DescriptionHardwoodsarethebotanicalgroupoftreesthathavebroadleaves,produceafruitornut,andgenerallygodormantinthewin
huayunhualuo
·
2015-08-05 16:00
SGU131
Hardwood
floor
SGU131Hardwoodfloor题目大意有一个N*M的矩阵,用1*2的矩形和2*2的L形不重叠无遗漏的覆盖,问有多少种方案算法思路状压DP,f[j][S]表示填满前j-1列,且第j列的状态为S的方案数对于第一列,直接判断能否用1*2的矩形覆盖,作为边界条件对于第j列,需要计算辅助状态g[S],表示第j-1列以及第j列的状态为S的方案数如果S只有第j-1列,则g[S]=f[j-1][S]否则找
u010929036
·
2015-06-14 00:00
dp
sgu
POJ 2418
Hardwood
Species(字典树)
HardwoodSpeciesTimeLimit: 10000MS MemoryLimit: 65536KTotalSubmissions: 20085 Accepted: 7911DescriptionHardwoodsarethebotanicalgroupoftreesthathavebroadleaves,produceafruitornut,andgenerallygodormantin
u013068502
·
2015-05-04 21:00
poj
POJ2418
Hardwood
Species Tire树
题目大意:若干棵树构成一片树林,我们知道每一棵树的名字,按树名字典序输出每种一树所占的比率。分析:由于树名不止是一个单词,可以用gets输入,输入的同时记录树的数量,字符串排序后遍历一遍即可。为了保证重复树名只输出一次,我们可以在每种树输出一次后标记它的状态,下次不再重复输出。实现代码如下:#include #include #include #include #include usingname
AC_Gibson
·
2015-05-03 17:00
POJ 2418
Hardwood
Species(trie的串排序运用)
题意:输入众多字符串(中间有空格),按字典序输出,且输出每个字符串所占整个字符串数量的百分比思路:用字典树的先序遍历,遍历到字符串的末尾便输出并算出百分比即可这题同样用C++stlmap可以很好解决,但毕竟题目是字典序,比如逆序就字典树同样可以解决//1632K782MS #include #include #include #include usingnamespacestd; structtr
kalilili
·
2015-02-27 23:00
POJ2418
Hardwood
Species(字典树)
HardwoodSpecies题目链接:http://poj.org/problem?id=2418解题思路:字典树的题,不过要用到dfs的一点小技巧;当然用map也可以做!AC代码(map):#include #include #include #include #include usingnamespacestd; constintmaxn=1000010; stringstr,name[1
piaocoder
·
2014-11-29 17:00
搜索
字典树
sgu131
Hardwood
floor
131.Hardwoodfloortimelimitpertest:0.25sec. memorylimitpertest:4096KBThebanquethallofComputerScientists'PalacehasarectangularformofthesizeMxN(1 #include #include #include #include #include usingnamespa
smilewsw
·
2014-10-15 22:00
dp
POJ2418——
Hardwood
Species
DescriptionHardwoodsarethebotanicalgroupoftreesthathavebroadleaves,produceafruitornut,andgenerallygodormantinthewinter.America'stemperateclimatesproduceforestswithhundredsofhardwoodspecies--treesthats
Guard_Mine
·
2014-09-01 15:00
字典树
POJ 2418
Hardwood
Species(STL中map的应用)
题目地址:POJ2418通过这个题查了大量资料。。知道了很多以前不知道的东西。。。。在代码中注释说明吧。代码如下:#include #include #include #include #include #include #include #include #include #include usingnamespacestd; intmain() { mapmp;//声明一个map容器,是一种
u013013910
·
2014-08-04 11:00
编程
算法
map
C语言
ACM
A -
Hardwood
Species(7.1.1)(利用STL中自带的排序功能编程的实验范例)
DescriptionHardwoodsarethebotanicalgroupoftreesthathavebroadleaves,produceafruitornut,andgenerallygodormantinthewinter.America'stemperateclimatesproduceforestswithhundredsofhardwoodspecies--treesthats
u014028231
·
2014-07-23 08:00
(经典map)A -
Hardwood
Species(7.1.1)(利用STL中自带的排序功能编程的实验范例)
DescriptionHardwoodsarethebotanicalgroupoftreesthathavebroadleaves,produceafruitornut,andgenerallygodormantinthewinter.America'stemperateclimatesproduceforestswithhundredsofhardwoodspecies--treestha
u014665013
·
2014-07-22 17:00
POJ 2418
Hardwood
Species(map)
第一次接触map关联容器~\(≧▽≦)/~详情见http://blog.csdn.net/sunshumin/article/details/38034003HardwoodSpeciesTimeLimit: 10000MS MemoryLimit: 65536KTotalSubmissions: 18080 Accepted: 7172DescriptionHardwoodsarethebota
u013263923
·
2014-07-22 10:00
poj 2418
Hardwood
Species (map)
小记:1A,笑炸我,9016MS,我在杭电的webdiy提交GNUC++也是9016MS思路:我之前也不晓得map它是怎么按string排序的,就先试试看,如果是按字母序排那就好了读取一行数据使用的是getline(cin,str)然后map[str]++;记录个数另外加一个变量cnt,记录总个数读取完所有数据后,从map的第一个元素开始一个一个的来输出,输出的结果确实是按字母序但是也担心会TLE
ljd4305
·
2014-05-12 17:00
[字典树] poj 2418
Hardwood
Species
题目链接:http://poj.org/problem?id=2418HardwoodSpeciesTimeLimit: 10000MS MemoryLimit: 65536KTotalSubmissions: 17511 Accepted: 6949DescriptionHardwoodsarethebotanicalgroupoftreesthathavebroadleaves,produce
cc_again
·
2014-05-11 09:00
上一页
1
2
下一页
按字母分类:
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
其他