Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Re:map水过 2500ms

Posted by Yt_zp at 2015-08-20 16:04:11 on Problem 2418
In Reply To:map水过 2500ms Posted by:Yt_zp at 2015-08-20 16:04:05
#include <map>
#include <cstdio>
#include <cstring>
#include <string>
#include <iostream>
using namespace std;
typedef map<string,int>record;
string s;
record h;
int main(){
    int n=0;
    while(getline(cin,s)){
        n++;
        h[s]++;
    }
    for(record::iterator it=h.begin();it!=h.end();it++){
        string name=(*it).first;
        int k=(*it).second;
        printf("%s %.4lf\n",name.c_str(),double(k)*100/double(n));
    }
    return 0;
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator