题目名称 1604. Hardwood Species
输入输出 pojtj.in/out
难度等级 ★☆
时间限制 10000 ms (10 s)
内存限制 7 MiB
测试数据 10
题目来源 GravatarOI永别 于2014-04-19加入
开放分组 全部用户
提交状态
分类标签
平衡树 POJ 散列
分享题解
通过:25, 提交:76, 通过率:32.89%
GravatarOI永别 100 1.287 s 4.89 MiB C++
Gravatar, 100 1.644 s 5.90 MiB Pascal
GravatarAlan 100 1.887 s 0.31 MiB C++
Gravatar绕着指尖 100 2.022 s 0.32 MiB C++
GravatarH_Lost 100 2.342 s 0.31 MiB C++
GravatarHe_Lost 100 2.343 s 0.31 MiB C++
GravatarRivendell 100 2.444 s 0.31 MiB C++
GravatarRiolu 100 2.480 s 0.31 MiB C++
GravatarJSX 100 2.485 s 0.28 MiB C++
Gravatarztx 100 2.496 s 0.28 MiB C++
关于 Hardwood Species 的近10条评论(全部评论)
为啥在本地木有输出= =
GravatarRiolu
2016-03-15 20:48 8楼
有种容器叫map
GravatarDream
2016-02-06 22:34 7楼
k=(float)(*B).second*100/n还可以这样用,我还是太孤陋寡闻。各位都是poj的大神而我还再使用洛谷。。。。。
GravatarNVIDIA
2015-08-14 19:01 6楼
为什么我用set在poj上能过,而在cojs会跪,一定是我的set还不熟练。。。
Gravatar奶猹
2014-10-23 17:01 5楼
Gravatar水中音
2014-10-23 16:39 4楼
回复 @高高高高高 :
STL真神奇
GravatarAlan
2014-04-21 20:01 3楼
哈希表真神奇。。。。。。。。。。。。。。。。
Gravatar,
2014-04-21 20:00 2楼
VIP用trie会超内存
GravatarOI永别
2014-04-20 08:31 1楼

1604. Hardwood Species

★☆   输入文件:pojtj.in   输出文件:pojtj.out   简单对比
时间限制:10 s   内存限制:7 MiB

【题目描述】

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 hundreds of hardwood species -- trees that share certain biological characteristics. Although oak, maple and cherry all are types of hardwood trees, for example, they are different species. Together, all the hardwood species represent 40 percent of the trees in the United States.

On the other hand, softwoods, or conifers, from the Latin word meaning "cone-bearing," have needles. Widely available US softwoods include cedar, fir, hemlock, pine, redwood, spruce and cypress. In a home, the softwoods are used primarily as structural lumber such as 2x4s and 2x6s, with some limited decorative applications.

Using satellite imaging technology, the Department of Natural Resources has compiled an inventory of every tree standing on a particular day. You are to compute the total fraction of the tree population represented by each species.

【输入格式】

Input to your program consists of a list of the species of every tree observed by the satellite; one tree per line. No species name exceeds 30 characters. There are no more than 10,000 species and no more than 1,000,000 trees.

【输出格式】

Print the name of each species represented in the population, in alphabetical order, followed by the percentage of the population it represents, to 4 decimal places.

【样例输入】

Red Alder
Ash
Aspen
Basswood
Ash
Beech
Yellow Birch
Ash
Cherry
Cottonwood
Ash
Cypress
Red Elm
Gum
Hackberry
White Oak
Hickory
Pecan
Hard Maple
White Oak
Soft Maple
Red Oak
Red Oak
White Oak
Poplan
Sassafras
Sycamore
Black Walnut
Willow

【样例输出】

Ash 13.7931
Aspen 3.4483
Basswood 3.4483
Beech 3.4483
Black Walnut 3.4483
Cherry 3.4483
Cottonwood 3.4483
Cypress 3.4483
Gum 3.4483
Hackberry 3.4483
Hard Maple 3.4483
Hickory 3.4483
Pecan 3.4483
Poplan 3.4483
Red Alder 3.4483
Red Elm 3.4483
Red Oak 6.8966
Sassafras 3.4483
Soft Maple 3.4483
Sycamore 3.4483
White Oak 10.3448
Willow 3.4483
Yellow Birch 3.4483

【提示】

This problem has huge input, use scanf instead of cin to avoid time limit exceeded.
ps:注意看题内存限制和时间限制
题目大意:统计每一个字符串出现的百分比,一共有10W种,100W个

【来源】

【题目来源】

北京大学 POJ 2418