HDU 5166 Missing number

来源:互联网 发布:单片机怎么学 编辑:程序博客网 时间:2024/05/20 18:18

题目:http://acm.hdu.edu.cn/showproblem.php?pid=5166

代码:

#include<stdio.h>int main(){    int T,i;    scanf("%d",&T);    while(T--)    {        int count,t=0,j[2];        scanf("%d",&count);        int flag[1005]={0};        for(i=1; i<=count; i++)        {            int s;            scanf("%d",&s);            flag[s]=1;        }        for(i=1; i<=count+2; i++)        {            if(flag[i]==0)            {                j[t++]=i;            }        }        printf("%d %d\n",j[0],j[1]);    }}

分析:

假酒害人,在网上抄的代码。

0 0