比赛 20120420 评测结果 WAWWWWT
题目名称 昵称 最终得分 14
用户昵称 Cloud 运行时间 0.000 s
代码语言 C++ 内存使用 0.00 MiB
提交时间 2012-04-20 08:50:41
显示代码纯文本
#include<fstream>
#include<set>
#include<cstring>
using namespace std;
int main(void)
{
	ifstream fin("nickname.in");
	ofstream fout("nickname.out");
	multiset<string> st;
	multiset<string>::iterator i;
	int n,m,num;
	string ch;
	fin>>n;
	for(;n;n--)
	{
		fin>>m;
		st.clear();
		for(;m;m--)
		{
			fin>>ch;
			st.insert(ch);
		}
		for(i=st.begin();1;i++)
		{
			if(i==st.end())break;
			num=st.count(*i);
			fout<<*i<<" "<<num<<endl;
			for(int k=0;k<num-1;k++)
				i++;
		}
		fout<<endl;
	}
	fin.close();
	fout.close();
	return 0;
}