Home > Back-end >  Small white for help "and two elements of k" problem (should be a very simple question)
Small white for help "and two elements of k" problem (should be a very simple question)

Time:01-13

The code I tried many are the answer right
But OJ has been Wrong Answer
No function, please take a look at the code where there are problems

CodePudding user response:

Suggest the original poster posted the source code

CodePudding user response:

Source:
# include
Int main ()
{
Int n, k, I, j, b;
Int a, [1000].
The scanf (" % d % d \ n ", & amp; N, & amp; K);
for(i=0; i{
The scanf (" % d ", & amp; A [I]);
For (j=I + 1; J{
If (a + [I] a [j]==k)
B=1;
The else
B=0;
}
}
If (b==1)
Printf (" yes \ n ");
The else
Printf (" \ n ");
return 0;
}

CodePudding user response:

Reference:
 # include 
Int main (int arg c, char * argv [])
{
Int n, k, I, j, b=0;
Int a, [1000].
The scanf (" % d % d \ n ", & amp; N, & amp; K);
for(i=0; iThe scanf (" % d ", & amp; A [I]);

for(i=0; iFor (j=I + 1; JIf (a + [I] a [j]==k) {
B=1;
break;
}
If (b) break;
}

If (b)
Printf (" yes \ n ");
The else
Printf (" \ n ");

return 0;
}
  • Related