LA6578 Trending Topic (2013-2014 ACM-ICPC Southwestern Europe Regional Contest I题) 模拟

题意:输出top n高频出现的词和对应词出现的次数。注意一点,可能出现超出n个输出的情况,当且仅当超出部分的单词出现次数和

第n个相同。

思路:模拟。

// file name: LA6578.cpp //
// author: kereo //
// create time:  2014年10月15日 星期三 23时11分51秒 //
//***********************************//
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
using namespace std;
typedef long long ll;
const int MAXN=200000+100;
const int inf=0x3fffffff;
const int mod=1000000000+7;
#define L(x) (x<<1)
#define R(x) (x<<1|1)
int n;
string str;
vectorvec[7];
struct node{
	int cnt;
	string s;
}nod[MAXN];
mapmp;
bool cmp(node a,node b){
	if(a.cnt == b.cnt)
		return a.sb.cnt;
}
int main()
{
	//freopen("text","r",stdin);
	int now=0;
	for(int i=0;i<7;i++) vec[i].clear();
	while(cin>>str){
		if(str==""){
			vec[now].clear();
			while(cin>>str){
				if(str=="")
					break;
				if(str.length()<4)
					continue;
				vec[now].push_back(str);	
			}
			now=(now+1)%7;
		}
		else{
			mp.clear();
			int cnt=0;
			cin>>n>>str;
			printf("\n",n);
			for(int i=0;i<7;i++){
				for(int j=0;j\n");
		}
	}
	return 0;
}




你可能感兴趣的:(杂)