Home > Back-end >  The small white for help
The small white for help

Time:06-08

#include
#include
Char a [1000] [15].
Int b [1000];
Int main () {
Int n, I, j, k, Max.
While (the scanf (" % d ", & amp; N)!=(EOF)
{
If (n=0)
break;
For (I=1; i<=n; I++)
{
b[i]=0;
The scanf (" % s ", a [I]);

}
For (I=1; i<=n; I++)
{
For (j=1; J<=n; J++)
If (STRCMP (a [I], a [j])==0)
{
B [I] + +;
}

}
Max=b [1];
K=1;
For (I=2; i{
If (b [I] & gt; Max)
{
Max=b [I];
K=I;
}

}
Printf (" % s \ n ", a [k]);
}
return 0;
}

The output limit exceeded what brothers rush!

CodePudding user response:

Compare that, why not compare to skip with yourself?

CodePudding user response:

Which refers to the comparison

CodePudding user response:

String comparison STRCMP

CodePudding user response:

 # include & lt; stdio.h> 
#include

Char a [1000] [15].
Int b [1000];

Int main ()
{
Int n, I, j, k, Max.
While (the scanf (" % d ", & amp; N)!=(EOF)
{
//if (n=0)
If (n==0)
break;
For (I=1; i<=n; I++)
{
b[i]=0;
The scanf (" % s ", a [I]);

}
For (I=1; i<=n; I++)
{
For (j=1; J<=n; J++)
If (STRCMP (a [I], a [j])==0)
{
B [I] + +;
}

}
Max=b [1];
K=1;
For (I=2; i{
If (b [I] & gt; Max)
{
Max=b [I];
K=I;
}

}
Printf (" % s \ n ", a [k]);
}
return 0;
}

For your reference ~

Every time the input of n will become zero.

CodePudding user response:

Above thank you friends

CodePudding user response:

reference 5 floor qinglouchangke reply:
above thank you friends

You're welcome

1, if the problem has been solved, please post in a timely manner, the , the
2, if no problem, can continue to cross-examine,
3, only on the computer and posted on the web, mobile phone cannot bear,
CSDN BBS newbie guide

CodePudding user response:


I hope it can help you: https://blog.csdn.net/it_xiangqiang/category_10581430.html
I hope it can help you: https://blog.csdn.net/it_xiangqiang/category_10768339.html
  • Related