简单题
![ContractedBlock.gif](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
![ExpandedBlockStart.gif](https://images.cnblogs.com/OutliningIndicators/ExpandedBlockStart.gif)
#include#include #include #include #include using namespace std; #define maxn 25 #define maxl 100 struct Candidate { int num; int id; } can[maxn]; int n, m; char name[maxn][maxl]; char party[maxn][maxl]; bool operator <(const Candidate &a, const Candidate &b) { return a.num > b.num; } int getid(char *st) { for (int i = 0; i < n; i++) if (strcmp(st, name[i]) == 0) return i; return -1; } void input() { char st[maxl]; scanf("%d", &n); getchar(); for (int i = 0; i < n; i++) { gets(name[i]); gets(party[i]); can[i].id = i; can[i].num = 0; } scanf("%d", &m); getchar(); for (int i = 0; i < m; i++) { gets(st); can[getid(st)].num++; } } int main() { //freopen("t.txt", "r", stdin); input(); sort(can, can + n); if (n > 1 && can[0].num == can[1].num) printf("tie\n"); else printf("%s\n", party[can[0].id]); return 0; }