A lost Stamp

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.