本文共 1071 字,大约阅读时间需要 3 分钟。
1、
2、题目:
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.
Notice that for each array A[] a unique array B[] exists.
InputThe 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.
OutputFor 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 Input8 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 Output1 2 3 4 5 6 7 8
1 2 3 4 5 6 7 8 1 2 3
3、AC代码:
#include#include #include using namespace std;int a[110];int i;int cmp(int a,int b){ return a
转载地址:http://eeddi.baihongyu.com/