杭电oj-1004--Let the Balloon Rise
2019-10-14 本文已影响0人
小小Henry
#include <stdio.h>
#include <string.h>
void Sum(char a[], char b[], int c[], int lena, int lenb);
int main(void)
{
int numbers;//气球数
int order=0;//存储次序
int max = 1, maxi = 0;//最大值和最大值下标
int i, j;
char a[1000][15] = { 0 };//存储颜色字符串
int b[1000] = { 0 };//存储数量
while (1)
{
scanf("%d", &numbers);
if (!numbers)
break;
/***********初始化*********/
char a[1000][15] = { 0 };
int b[1000] = { 0 };
order = 0;
max = 1;
maxi = 0;
/************************/
for (i = 0; i < numbers; i++)
{
scanf("%s", a[i]);
for (j = 0; j < order; j++)
{
if (strcmp(a[i], a[j]) == 0)
{
if (++b[j] > max)
{
max = b[j];
maxi = j;
}
goto A;
}
}
b[order] = 1;
order++;
A:;
}
for (i = maxi; b[i]; i++)
{
if (b[i] == max)
printf("%s\n", a[i]);
}
//printf("%s", a[maxi]);
}
}