青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品

poj2418

Hardwood Species

Time Limit: 10000MS Memory Limit: 65536K
Total Submissions: 13263 Accepted: 5434

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 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

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.

Output

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.

Sample Input

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

Sample Output

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

Hint

This problem has huge input, use scanf instead of cin to avoid time limit exceeded.

Source

Waterloo Local 2002.01.26

所有字符都有
水的trie樹+dfs
#include <cstdio>
#include 
<cstdlib>
#include 
<cstring>
#include 
<cmath>
#include 
<ctime>
#include 
<cassert>
#include 
<iostream>
#include 
<sstream>
#include 
<fstream>
#include 
<map>
#include 
<set>
#include 
<vector>
#include 
<queue>
#include 
<algorithm>
#include 
<iomanip>
#define maxn 40000
using namespace std;
struct node
{
    
int next[256];
    
int count;
    
void init()
    
{
        memset(next,
-1,sizeof(next));
        count
=0;
    }

}
s[maxn];
int sind;
int num,ans,n;
char str[50];
void cas_init()
{
    s[
0].init();
    sind
=1;
}

int ins(char str[])
{
    
int i,j,ind;
    ind
=0;
    
for(int i=0;i<strlen(str);i++)
    
{
        j
=str[i];
        
if(s[ind].next[j]==-1)
        
{
            s[sind].init();
            s[ind].next[j]
=sind++;
        }

        ind
=s[ind].next[j];
    }

    
if(s[ind].count!=0)
    
{
        s[ind].count
++;
        
return 0;
    }

    
else
    
{
        s[ind].count
++;
        
return 1;
    }

}

void dfs(int id,int depth)
{
    
if(s[id].count>0)
    
{
        str[depth]
='\0';
        printf(
"%s %.4lf\n",str,(s[id].count*100.0/double(num)));
    }

    
for(int i=0;i<256;i++)
    
if(s[id].next[i]!=-1)
    
{
        str[depth]
=i;
        dfs(s[id].next[i],depth
+1);
    }

}

int main()
{
    
int flag;
    
char str[40];
    n
=0;num=0;
    
//printf("%d",strcmp("!","@"));
    
//freopen("in1.txt","r+",stdin);
    cas_init();
    
while(gets(str))
    
{
        num
++;
        flag
=ins(str);
        
if(flag==1) n++;
    }

    dfs(
0,0);
    
//fclose(stdin);
    return 0;
}


posted on 2012-07-24 13:53 jh818012 閱讀(178) 評論(0)  編輯 收藏 引用


只有注冊用戶登錄后才能發(fā)表評論。
網(wǎng)站導(dǎo)航: 博客園   IT新聞   BlogJava   博問   Chat2DB   管理


<2025年11月>
2627282930311
2345678
9101112131415
16171819202122
23242526272829
30123456

導(dǎo)航

統(tǒng)計

常用鏈接

留言簿

文章檔案(85)

搜索

最新評論

  • 1.?re: poj1426
  • 我嚓,,輝哥,,居然搜到你的題解了
  • --season
  • 2.?re: poj3083
  • @王私江
    (8+i)&3 相當(dāng)于是 取余3的意思 因為 3 的 二進(jìn)制是 000011 和(8+i)
  • --游客
  • 3.?re: poj3414[未登錄]
  • @王私江
    0ms
  • --jh818012
  • 4.?re: poj3414
  • 200+行,跑了多少ms呢?我的130+行哦,你菜啦,哈哈。
  • --王私江
  • 5.?re: poj1426
  • 評論內(nèi)容較長,點擊標(biāo)題查看
  • --王私江
青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            欧美一区二区三区免费观看视频 | 亚洲裸体在线观看| 久久亚洲影音av资源网| 亚洲三级免费电影| 亚洲视频免费| 亚洲国产精品专区久久| 一本一道久久综合狠狠老精东影业 | 欧美精品在线视频观看| 亚洲欧美一区二区精品久久久| 小辣椒精品导航| 亚洲免费成人av电影| 亚洲图片自拍偷拍| 亚洲高清中文字幕| 亚洲一级片在线观看| 亚洲第一二三四五区| 亚洲美女黄网| 韩国精品久久久999| 亚洲麻豆视频| 午夜精品视频| 亚洲精品久久久久久久久久久久| 99国产欧美久久久精品| 国产午夜精品一区理论片飘花 | 免费观看成人www动漫视频| 亚洲国产精品成人一区二区| 99天天综合性| 尤妮丝一区二区裸体视频| 一区二区三区精密机械公司| 国产亚洲成av人片在线观看桃| 欧美成人一二三| 国产精品乱看| 久久综合网络一区二区| 欧美日韩一区二区视频在线观看| 欧美在线免费观看| 亚洲午夜高清视频| 欧美日韩国产一区二区三区地区 | 日韩一级片网址| 欧美在线视频免费播放| 亚洲人成7777| 欧美性开放视频| 欧美午夜视频| 亚洲一区二区三| 亚洲欧美制服另类日韩| 亚洲人成在线观看网站高清| 亚洲永久精品大片| 日韩视频精品在线| 久久精品免费看| 亚洲欧美成人一区二区在线电影| 久久综合伊人77777| 久久精彩视频| 亚洲欧美久久久久一区二区三区| 美女成人午夜| 久久久精品国产免大香伊 | 欧美日韩午夜在线| 美女脱光内衣内裤视频久久影院| 国产精品久久| 亚洲国产一区二区三区在线播| 亚洲欧美精品suv| 亚洲午夜精品久久久久久app| 欧美69视频| 免费久久99精品国产自| 欧美大片在线影院| 久久精品人人| 国产精品v日韩精品v欧美精品网站| 欧美福利专区| 国产伦精品一区二区| 欧美成人综合| 国产乱人伦精品一区二区| 亚洲国产一区二区三区a毛片| 激情婷婷久久| 久久福利资源站| 久久免费视频网站| 狠狠色狠狠色综合日日tαg| 欧美一区二区三区久久精品茉莉花| 午夜免费在线观看精品视频| 欧美午夜剧场| 亚洲一二三区在线| 欧美一区综合| 国产综合自拍| 欧美.com| 亚洲精品女av网站| 国产一区二区看久久| 亚洲国产精品欧美一二99| 亚洲国产精品视频一区| 美腿丝袜亚洲色图| 亚洲人成网站777色婷婷| 一区二区三区日韩| 欧美日韩精品中文字幕| 欧美色区777第一页| 国产精一区二区三区| 韩国一区二区在线观看| 午夜精品久久久久久久99黑人| 久久亚洲精品视频| 亚洲精品在线视频| 99国产精品久久久久久久成人热| 99国产精品视频免费观看| 亚洲午夜一级| 日韩亚洲欧美一区| 久久精品国产亚洲一区二区| 欧美大片一区| 欧美中文字幕在线播放| 亚洲精品乱码| 欧美高清不卡在线| av成人免费观看| 欧美二区在线播放| 亚洲激情社区| 日韩天堂av| 亚洲大胆人体在线| 91久久精品www人人做人人爽| 亚洲免费久久| 亚洲午夜在线视频| 久久久夜夜夜| 一区二区三区国产在线| 欧美激情视频在线播放| 欧美日韩高清不卡| 欧美午夜一区| 激情成人av在线| 午夜精品在线看| 久久综合狠狠综合久久综合88 | 欧美精品情趣视频| 亚洲美女少妇无套啪啪呻吟| 久久久国际精品| 99视频国产精品免费观看| 激情小说亚洲一区| 欧美午夜久久| 欧美日韩一级大片网址| 老司机午夜免费精品视频 | 亚洲人成77777在线观看网| 国产日韩精品在线观看| 欧美午夜不卡视频| 美女视频一区免费观看| 久久久亚洲综合| 亚洲天堂视频在线观看| 亚洲乱亚洲高清| 欧美jjzz| 久久亚洲图片| 亚洲人成在线观看| 欧美一级午夜免费电影| 国产欧美日韩在线观看| 久久成人免费视频| 久久九九久精品国产免费直播| 国产日韩精品一区二区三区在线 | 亚洲欧洲视频| 亚洲欧美日本精品| 亚洲精品久久嫩草网站秘色| 欧美日韩免费看| 久久久久久久综合| 午夜在线一区| 亚洲一级黄色| 亚洲欧美一区二区激情| 一区二区免费在线播放| 亚洲一区二区动漫| 一区二区三区视频在线| 亚洲欧洲日韩女同| 一本久久精品一区二区| 亚洲第一在线| 亚洲激情亚洲| 亚洲国产精品一区二区第四页av| 欧美大片91| 蜜桃av一区二区三区| 久久综合九色综合欧美就去吻| 久久精品成人一区二区三区蜜臀| 久久麻豆一区二区| 国产精品视频精品| 国产女人精品视频| 国产精品毛片在线| 欧美激情亚洲激情| 欧美肥婆在线| 另类综合日韩欧美亚洲| 欧美大尺度在线| 欧美一区二区三区精品电影| 久久综合狠狠| 欧美成人免费在线观看| 国产精品国产三级国产aⅴ浪潮| 欧美日韩国内| 国产婷婷色一区二区三区在线| 国产精品视频免费| 亚洲国产精品成人精品| 亚洲精品永久免费| 欧美一区免费视频| 久久在线91| 一区二区三区精品久久久| 国产精品日韩在线一区| 久久精品夜色噜噜亚洲aⅴ| 午夜综合激情| 欧美精品一区二区视频| 欧美视频观看一区| 国产午夜亚洲精品不卡| 亚洲国产精品毛片| 亚洲视频欧美在线| 亚洲免费网站| 亚洲一区二区三区欧美| 香蕉成人久久| 老司机成人在线视频| 亚洲国产精品视频| 久久黄色网页| 欧美日韩高清在线| 在线观看日韩av| 亚洲视频精品| 欧美黄色免费| 亚洲免费网址|