The Sample Input
10
1 1 1 1 1 1 2 2 2 2
The Sample Output
1
2
#include
Int main () {
Int n, I, j, a [100], [100] b, w, count, p=0;
The scanf (" % d ", & amp; n);
for(i=0; i
for(i=0; i
For (j=I + 1; j
count++;
}
If (count==0)
B=[p++] a [I];
}
for(i=0; iPrintf (" % d, b [I]);
return 0;
}
CodePudding user response:
Please look at the question clearly, ensure the first appearance of each element of the sequence of consistency, so in some cases, this algorithm can't satisfy youCodePudding user response:
Try array into 100 wCodePudding user response:
Can use the STD: : set:#include
#include
Int main ()
{
Int n, x;
STD: : set
The scanf (" % d ", & amp; n);
While (n -)
{
The scanf (" % d ", & amp; X);
Auto r=s.i nsert (x);
If (r.f first!=s.e nd () & amp; & * r.f irst==x & amp; & R.s econd)
Printf (" % d % s ", x, n? "" :" ");
}
Puts (" ");
return 0;
}