Home > Back-end >  Help!!!!! Why don't I have the OJ
Help!!!!! Why don't I have the OJ

Time:10-12

The codeblock I tried a lot of examples to, but to submit to the OJ is wrong, I don't know is what problem,
This is the code:
#include
#include
Int main ()
{
Char a [100] [100].
Char b [100] [100].
Char c [100];
Int I, j, k, p, n, x=0;
Int (p1, p2, p3, p4, p5, c1, c2, c3, c4 and c5;
The scanf (" % d ", & amp; N);
for(i=0; i<=n; I++)
{
C1=0, c2=0, c3=0, c4=0, c5=0;
Gets (a [I]);
For (p1=0; P1 & lt; Strlen (a [I]); P1 + +)
If (a [I] [p1]=='h') {c1 + +; break; }
For (p2=p1; The p2 & lt; Strlen (a [I]); The p2 + +)
If (a [I] [p2]=='a') {c2 + +; break; }
For (p3=p2; P3 & lt; Strlen (a [I]); P3 + +)
If (a [I] [p3]=='p') {c3 + +; break; }
For (p4=p3; P4 & lt; Strlen (a [I]); P4 + +)
If (a [I] [p4]=='p') {c4 + +; break; }
For (p5=p4; P5 & lt; Strlen (a [I]); P5 + +)
If (a [I] [p5]=='y') {c5 + +; break; }
If (c1==1 & amp; & C2==1 & amp; & C3==1 & amp; & C4==1 & amp; & C5==1)
{strcpy (b [x], a [I]); X++; }
}
for(k=0; kfor(j=0; j{
If (STRCMP (b [j], [m + 1] b) & gt; 0)
{
Strcpy (c, b [j]); Strcpy (b [j], [j b + 1)); Strcpy (b [j + 1), c);
}
}
for(i=0; iPrintf (" % s \ n ", [I] b);
return 0;
}
  

CodePudding user response:

Pictures don't put in code label, you this program to what purpose

CodePudding user response:

The input and output is encrypted, you is subject to ah...

CodePudding user response:

Topic is like this:
All contains a happy as a substring of string string called happy (happy each letter does not necessarily appear in a row, but the order the same), to give you a number of strings, you can find out all happy string?
Input requirements
The first line, enter a positive integer n n strings, the next input n lines, each line of input a string, (n<=100; Each string length is less than 100)


Output requirements
All output string, each one, according to the dictionary sequence sorting,


The input sample
6
Sdffhappysdfds
Asdfhapfsdpy
Dfdhappy
RDFGF
FDSFSSD
Happy


The output sample
Asdfhapfsdpy
Dfdhappy
Happy
sdffhappysdfds

CodePudding user response:

Where is this to junk code

CodePudding user response:

I,,,,, is my own way, I know that is very poor, I will slowly to learn,

CodePudding user response:

For (p1=0; P1 & lt; Strlen (a [I]); P1 + +)
If (a [I] [p1]=='h') {c1 + +; break; }
To compile and run the right amazing,

CodePudding user response:

For (p1=0; P1 & lt; Strlen (a [I]); P1 + +)
If (a [I] [p1]=='h') {c1 + +; break; }
For (p2=p1; The p2 & lt; Strlen (a [I]); The p2 + +)
If (a [I] [p2]=='a') {c2 + +; break; }
The two loops is provided or nested?

CodePudding user response:

The first for loop i<=n will cycle n + 1 times case-insensitive and that happy?
  • Related