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

其实这道题26行的程序就可以过了→

Posted by Akaline at 2017-02-07 11:13:41 on Problem 2418
#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:
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