Home > Back-end >  To solve the problem is I which is wrong
To solve the problem is I which is wrong

Time:12-11

This broken platform not to test cases
https://paste.ubuntu.com/p/Vy7qSDWq5d/
My own test no problem
 # include & lt; stdio.h> 
#include
#include
#include
Int main () {

Int right amount;
The scanf (" % d % d ", & amp; Right, & amp; Amount).
Int loc [27]={0};
Loc [26]=right;
Char correct [right] [23];
Int [26] CNT={0};

Char result [amount] [4];
//memset (result, 0, sizeof (char) * 4 * amount);
Int fir=0;
getchar();
Int now_cha=0;
for(int i=0; i[I] gets (correct);
Fir=correct [I] [0] - 97;
CNT [fir] + +;
If (fir> Now_cha) {
Now_cha=fir;
Loc [fir]=I;
}
}
Char \ [22].
for(int j=0; j
Int judge=1;
Gets (temp);
Fir=\ [0] - 97;
If (CNT (fir)==0) {
The result [j] [0]='T';
The result [j] [1]='A';
The result [j] [2]='T';
The result [j] [3]='\ 0';
continue;
}
Int t=0;
Int k=fir;
While (t==0) {
T=loc [k++];
}
For (int I=loc (fir); iJudge=STRCMP (temp, correct [I]);

If (judge==0) {
break;
}

}
If (judge==0) {
The result [j] [0]='Q';
The result [j] [1]='A';
The result [j] [2]='Q';
The result [j] [3]='\ 0';
}
The else
{
The result [j] [0]='T';
The result [j] [1]='A';
The result [j] [2]='T';
The result [j] [3]='\ 0'; }
}
for(int i=0; iPrintf (" % s \ n ", the result [I]);
}
return 0; }

CodePudding user response:

CodePudding user response:

About 5555555

CodePudding user response:

Who is too strong, with I

CodePudding user response:

See I write binary template

CodePudding user response:

 int right amount; 
The scanf (" % d % d ", & amp; Right, & amp; Amount).
Int loc [27]={0};
Loc [26]=right;
Char correct [right] [23];
Int [26] CNT={0};

Char result [amount] [4];

Don't be too confident, the result and correct array are lines of uncertainty, the C language does not support the variable array, so the length of the array is needed to determine the,

 gets (correct [I]); 

The column number of the array is 23, if the input of cross-border, how will you deal with?

Test cases can not only consider the right, but also consider abnormal data,
For white box testing, no problem, but for black box testing how to solve and avoid the program does not collapse?

CodePudding user response:

The building Lord you like C99 van son, but are you sure you don't make the ANSI C "broken platform"?
  • Related