Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
Re:map水过 2500msIn 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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator