rqnoj-407
来源:互联网 发布:公司单页网站源码 编辑:程序博客网 时间:2024/06/07 08:39
#include<iostream>#include<fstream>#include<cstdio>#include<algorithm>#include<iomanip>using namespace std;string tower[100002];int main(){ //fstream cin("d:\\test.txt"); int words=0; string s; while(cin>>s) tower[words++]=s; sort(tower,tower+words); tower[words]=""; s=tower[0]; int count=1; for(int i=1;i<=words;++i) if(s==tower[i]) ++count; else { cout<<s<<" "; double per=(double)count*100.0/(double)words; cout<<setiosflags(ios::fixed)<<setprecision(4)<<per<<endl; s=tower[i]; count=1; } return 0;}