ZOJ 【水题】排序程序输出结果是对的,wrong answer!该怎么处理

ZOJ 【水题】排序程序输出结果是对的,wrong answer!
#include<stdio.h>
#include<string.h>

int main()
{
int a[100],n,i,j,t,min;
while(scanf("%d",&n)!=EOF&&n)
{
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
for(i=0;i<n;i++)  /*冒泡排序*/
{
min=i;
for(j=n-1;j>i;j--)
{
if(a[j]<a[min])
min=j;
}
           if(min!=i)
   {
   t=a[i]; a[i]=a[min];a[min]=t;
   }

}

       
        printf("%d",a[0]);
        for(i=1;i<n;i++)           /*输出*/
{
if(a[i]==(a[i-1]+1))       /*如果1,2 或者2,3,后一位比前一位大1,则输出*/
printf(" %d",a[i]);
else
if(a[i]==a[i-1]) /*如果1,1,1这种都相同的情况,不输出,继续for循环*/
;
else   /*否则,跳出循环*/
 break;
}
printf("\n");
}

return 0;
}


按照的input输入过,output都是一样的,但是它说 wrong answer???求解!
zoj 的 2481


Unique Ascending Array
Time Limit: 2 Seconds      Memory Limit: 65536 KB
Given an array of integers A[N], you are asked to decide the shortest array of integers B[M], such that the following two conditions hold.

For all integers 0 <= i < N, there exists an integer 0 <= j < M, such that A[i] == B[j]
For all integers 0 =< i < j < M, we have B[i] < B[j]
Notice that for each array A[] a unique array B[] exists.


Input

The input consists of several test cases. For each test case, an integer N (1 <= N <= 100) is given, followed by N integers A[0], A[1], ..., A[N - 1] in a line. A line containing only a zero indicates the end of input.


Output

For each test case in the input, output the array B in one line. There should be exactly one space between the numbers, and there should be no initial or trailing spaces.


Sample Input

8 1 2 3 4 5 6 7 8
8 8 7 6 5 4 3 2 1
8 1 3 2 3 1 2 3 1
0


Sample Output

1 2 3 4 5 6 7 8
1 2 3 4 5 6 7 8
1 2 3
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=1481
按照的input输入过,output都是一样的,但是它说 wrong answer???求解!
zoj 的 2481

input

------解决方案--------------------
引用:
引用:你只考虑了例子,没有考虑一般情况