博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
zoj 2481 Unique Ascending Array
阅读量:4036 次
发布时间:2019-05-24

本文共 1071 字,大约阅读时间需要 3 分钟。

1、

2、题目:

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

 

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/

你可能感兴趣的文章
[LeetCode By MYSQL] Combine Two Tables
查看>>
如何打开ipynb文件
查看>>
[Leetcode BY python ]190. Reverse Bits
查看>>
Android下调用收发短信邮件等(转载)
查看>>
Android中电池信息(Battery information)的取得
查看>>
SVN客户端命令详解
查看>>
Android/Linux 内存监视
查看>>
Linux系统信息查看
查看>>
用find命令查找最近修改过的文件
查看>>
Android2.1消息应用(Messaging)源码学习笔记
查看>>
Phone双模修改涉及文件列表
查看>>
android UI小知识点
查看>>
Android之TelephonyManager类的方法详解
查看>>
android raw读取超过1M文件的方法
查看>>
ubuntu下SVN服务器安装配置
查看>>
MPMoviePlayerViewController和MPMoviePlayerController的使用
查看>>
CocoaPods实践之制作篇
查看>>
[Mac]Mac 操作系统 常见技巧
查看>>
苹果Swift编程语言入门教程【中文版】
查看>>
捕鱼忍者(ninja fishing)之游戏指南+游戏攻略+游戏体验
查看>>