The author has 1 post.
Font size: Small - 100% (Default)  Content converter: No conversion
 
Clicks Replies
956 0
【试题】错误票据
巨大八爪鱼
武林盟主 二十一级
Reply
Floor 1 Posted at: 3/15/16 14:38
#include <stdio.h>

int main(void)
{
    int a[100001];
    int i, n, temp, temp2;
    int min, max;
    int first = 1;
    char ch;
    scanf("%d", &n);
    for (i = 0; i < n; i++)
    {
        do
        {
            scanf("%d", &temp);
            if (first)
            {
                min = max = temp;
                first = 0;
            }
            else
            {
                if (temp < min)
                    min = temp;
                if (temp > max)
                    max = temp;
            }
            a[temp]++;
            ch = getchar();
        } while (ch == ' ');
    }
    for (i = min; i < max; i++)
    {
        if (a[i] == 2)
            temp = i;
        if (a[i] == 0)
            temp2 = i;
    }
    printf("%d %d\n", temp2, temp);
    return 0;
}
Reply the post
Content:
User: You are currently anonymous.
Captcha:
Unclear? Try another one.
(Shortcut key: Ctrl+Enter)
Post Information
Clicks: 956 Replies: 0
Author: 巨大八爪鱼
Last reply: 巨大八爪鱼
Last reply time: 3/15/16 14:38
Announcements