Home > Back-end >  Uva on excuse! Excuse! Has this problem, other OJ, how I always runtime error? And there is no limit
Uva on excuse! Excuse! Has this problem, other OJ, how I always runtime error? And there is no limit

Time:10-13

//# define LOCAL
# include
# include
# include
# include

Char KWL [30] [30].
Char exs [30] [80].
Char \ [80] [80].
Int Max [30];

Int main ()
{
//# ifdef LOCAL
//freopen (" E: \ \ My documents \ \ My C + + and C \ \ \ \ UVaOJ OJ subject \ \ V1 Elementary school Problem Solving \ \ String \ \ data409 in ", "r", stdin);
//freopen (" E: \ \ My documents \ \ My C + + and C \ \ \ \ UVaOJ OJ subject \ \ V1 Elementary school Problem Solving \ \ String \ \ data409 out ", "w", stdout);
//# endif
Int k, e;//k for the number of keywords
Int exset=0;//to print the set number
While (the scanf (" % d % d ", & amp; K, & amp; E)==2)
{exset++;
Memset (KWL, 0, sizeof (KWL));
Memset (exs, 0, sizeof (exs));
for(int i=0; iThe scanf (" % s ", & amp; KWL [I]);
getchar();
Int maxkw=0;//contains the most number of keywords
Int ii=0;//record contains Max a keywords excuse subscript
for(int i=0; i{//for each excuse
char c;
Int j=0;
Int n=0, m=0;//n as the word subscript, m for the character of each word subscript
Memset (temp, 0, sizeof (temp));
while((c=getchar())!='\ n')//line
{
Exs [I] [j++]=c;//first intact preserved
If (isalpha (c)) \ [n] [m++]=tolower (c);
The else//each letter, shows the current input end of the word, on to the next word input
{
\ [n] [m]='\ 0';//the end of the word
If (m) + + n. M=0; }//m is 0, if on a character is a letter, the n word has not yet been input, so you don't have n++
}//while
Exs [I] [j]='\ 0';
int count=0;//each excuse contains the number of keywords
for(int x=0; X<=n; + + x)//each word
for(int y=0; Y{
if(! STRCMP (temp [x], KWL [y]))
{//printf (" % s % s \ n ", temp [x], KWL [y]);
+ + count;
}//string not==C, use STRCMP
}
//printf (" % d \ n ", count);
If (count==maxkw) {Max [ii++]=I; }
Else if (count> Maxkw) {ii=0; Max [ii++]=I; Maxkw=count; }
}//for

Printf (" Excuse Set # % d \ n ", exset);
for(int i=0; iPrintf (" % s \ n ", exs [Max [I]]).
printf("\n");
}//while

//system (" pause ");
return 0;
}

Is the code above, which a great god can see? Thank you very much,,,

CodePudding user response:

Code I'm not see, touched directly vs08 run, run temporarily didn't find the runtime error

CodePudding user response:

reference 1st floor sololie response:
code I'm not see, touched directly vs08 run, run temporarily didn't find the runtime error
running locally is yes, I also passed with test data, is committed to the OJ, return the result is the runtime error,,,
  • Related