PC/UVA 110108/10142
模拟。
//author: CHC
//First Edit Time: 2014-01-14 14:37
//Last Edit Time: 2014-01-15 22:03
//Filename:1.cpp
#include <iostream>
#include <cstdio>
#include <string.h>
#include <queue>
#include <vector>
#include <algorithm>
using namespace std;
int n,t,ns;
char s[30][100];
char ts[1000];
vector <int> vote[1010];
vector <int> ::iterator it;
int ha[30];
void getnum(int kn)
{
int i=0;
while(ts[i])
{
while(ts[i]==' '&&ts[i])i++;
int tt=0;
while(ts[i]!=' '&&ts[i]){
tt=tt*10+ts[i]-'0';
++i;
}
if(tt!=0)vote[kn].push_back(tt);
}
}
void voted()
{
for(int i=0;i<ns;i++){
ha[vote[i][0]]++;
}
while(1){
int ping=1,min=1010,first=-1;
for(int i=0;i<n;i++){
if(ha[i+1]>ns/2){
printf("%s\n",s[i]);
return ;
}
/*
if(ha[i+1]>=0&&first==-1)first=ha[i+1];
if(first>=0&&ha[i+1]>=0&&ha[i+1]!=first)ping=0;
if(ha[i+1]>=0&&ha[i+1]<min)min=ha[i+1];
*/
///*
if(ha[i+1]>=0){
if(min!=1010&&min!=ha[i+1])ping=0;