Descriptive narrative
L not only do they like collecting stamps, they also like to collect each stamp in pairs. To prevent confusion, he numbered each type of stamp with a positive integer. However, one day he lost a couple of stamps. It is known that these two stamps are of different types, that is, their numbering is not the same. L hope you can help him find the number of these two missing stamps.
Input
The first line of input for each test data is a positive integer n (4<=n<=1000000), which indicates that the number of stamps with the original L has been n-2 Lines, one positive integer x (1<=x<=2^31-1)per line, indicating the stamp number.
Output
each test data output has only one row, two positive integers, indicating the missing stamp number, the small number in front, two integers separated by a space.
Example input
6
101
2
100
2
Example output
101
#include <iostream> #include <algorithm> #include <stdio.h>using namespace Std;long long a[ 1000005],x[5];int Main () { long long n,j,t; while (~SCANF ("%i64d", &n)) { j=0; for (int i=0;i<n-2;i++) scanf ("%i64d", &a[i]); Sort (a,a+n-2); for (int i=0;i<n-3;) { t=0; if (a[i]!=a[i+1]) { if (i!=0) { x[j++]=a[i]; i++; t=1; } else { x[j++]=a[i]; i++; t=1; } } if (!t) i+=2; } if (j==1) x[j]=a[n-3]; printf ("%i64d%i64d\n", x[0],x[1]); } return 0;}
A lost Stamp