Map Tree Varieties

Source: Internet
Author: User

Tree varieties

Timelimit:1 Second memorylimit:32 Megabyte

totalsubmit:517 accepted:120

Description

Hardwoods are broad-leaved trees that produce fruit or nuts and hibernate in winter.

The temperate climate of the United States produces hundreds of kinds of hardwood forests, which are groups of trees with some common biological characteristics. Although oak, maple and cherry are all hardwood species types, they are different species. In short, all hardwood species occupy 40% of the trees in the United States.

On the other hand, softwood or coniferous trees (needles from Latin words, meaning "cone bearings") have needle-like leaves in the United States, which are widely used in cork including cedar, fir, hemlock, pine, Sequoia, Spruce and cypress. At home, Cork is mainly used for structural timber, such as 2x4s and 2x6s, and some decorations.

Using satellite imaging technology, the Ministry of Natural Resources Records the directory of every tree in a day. You have to figure out the number of trees for each species.

Input

The input includes a list of the species of trees each day observed by the satellite, one row per tree. A symbol name is less than 30 characters. The number of species not exceeding 10,000 trees is not more than 1,000,000.

Output

The varieties of trees are output in alphabetical order, then the proportion of the species in the whole, accurate to four 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 have huge input, use scanf instead of CIN to avoid time limit exceeded.

1#include <iostream>2#include <string>3#include <map>4#include <cstdio>5 using namespacestd;6 intMain () {7map<string,int>Mapp1;8     strings;9     intCount =0; Ten      while(Getline (CIN, s)) { Onemapp1[s]++; Acount++; -     } -COUT.SETF (iOS::fixed); theCout.precision (4); -      for(map<string,int>::iterator it = Mapp1.begin (); It! = Mapp1.end (); it++){ -         Doubleper = -* ((Double) It->second/(Double) count); -cout << It->first <<" "<< per <<Endl; +     }  -     return 0; +}
View Code

Map Tree Varieties

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.