| ||||||||||
| 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 | |||||||||
其实这道题26行的程序就可以过了→#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
using namespace std;
string tree[1000001];
int n=0,ans=0;
int cmp(string a,string b)
{
return a<b;
}
int main()
{
while(getline(cin,tree[n]))n++;
sort(tree,tree+n,cmp);
for(int i=0;i<n;i++)
{
ans++;
if(tree[i+1]!=tree[i])
{
cout<<tree[i];
printf(" %0.4lf\n",(ans*100.0)/(n*1.0));
ans=0;
}
}
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator