Wednesday, May 10, 2017

URI Solution 1260 Hardwood Species | Data Structures

URI Solution 1260 Hardwood Species | Data Structures

URI Online Judge Solution 1260 Hardwood Species  | Data structures

Problem Name: URI Problem 1260 Hardwood Species 
Problem Number : URI Problem 1260 Hardwood Species Solution
Online Judge : URI Online Judge Solution
Level: Data structures
Solution Language : C, C plus plus

URI Solution 1260 Hardwood Species | Data Structures


URI Solution 1260 Hardwood Species Code in CPP:


#include <iostream>
#include <iomanip>
#include <map>
#include <cstring>
  
using namespace std;
  
int main(){
    int n, t, count = 0;
    char c[31];
    double tot;
    map<string, int> map;
    std::map<string, int>::iterator it;
  
    cin >> n; cin.ignore();
    
    for (int i = 0; i < n; i++)
    {
     map.clear();
        tot = 0;
        if (count != 0){
         cout << endl;
        }else{
         gets(c); 
        }

        while (gets(c) && c[0] != '\0')
        {
            map[c]++;
            tot++;
        }
  
        for (it = map.begin(); it != map.end(); it++)
            cout << it->first << " " << fixed << setprecision(4) << (it->second*100*1.0)/tot << endl;
       
        count++;
    }

    return 0;
}

Tag: Uri solve 1260 Hardwood Species  , Uri solution 1260 Hardwood Species , URI oj Solve 1260 Hardwood Species 

No comments:
Write comments

To know more about the problem, give us your valuable commment. We'll try to help you. Thanks

All rights reserved ©2016 -URI ONLINE JUDGE SOLUTION | Developed by Maniruzzaman Akash

© 2016 URI ONLINE JUDGE SOLUTION. Developed by Maniruzzaman Akash | Distributed By Gooyaabi Templates
Powered by Blogger.