CDN加速镜像 | 设为首页 | 加入收藏夹
当前位置: 首页 资源下载 源码下载 Windows编程 C#编程

文件名称:sort

  • 所属分类:
  • 标签属性:
  • 上传时间:
    2013-03-31
  • 文件大小:
    6.86kb
  • 已下载:
    0次
  • 提 供 者:
  • 相关连接:
  • 下载说明:
    别用迅雷下载,失败请重下,重下不扣分!

介绍说明--下载内容来自于网络,使用问题请自行百度

一个实验室里有n个长短不一的试管。你的任务是编写一段程序,用机器臂把它们按照高度从小到大的顺序排列。对于高度相同的试管,排序前后的相对位置应保持不变。排序方法如图所示。



排序需要n次操作,其中第i次操作是反转序列i~Pi,其中Pi是目标状态中第i个试管当前所在的位置。比如,在上图中,初始时P1=4,因此反转试管1~4就能把最左边的试管归位。类似地,第2次操作前P2=6,因此反转2~6就能把左数第2个试管归位。

你的任务是输出P1,P2,…,Pn的值,以便控制机器臂移动。注意i=Pi时实际上不需要反转,但仍然需要输出Pi。

【输入格式】

输入包含多组测试数据。每组数据第一行为试管个数n(1≤n≤100000),第二行从左到右依次为每个试管的高度。

【输出格式】

对于每组数据,输出一行,依次为P1,P2,…,Pn。

-N test tubes of varying lengths in a laboratory. Your task is to write a program, with a robotic arm from small to large order according to height. For the relative position of the same height before and after the test tube, sort should remain unchanged. Sorting method shown in Fig. Sorting requires n times of operation, wherein the i-th operation is the reversed sequence I ~~ Pi, where Pi is the i-th test tube current location of the target state. For instance, In the figure, the initial P1 = 4, therefore inverted test tube 1 to 4 will be able to put the most left of the tube homing. Similarly, before the second operation P2 = 6, therefore inverted 2 to 6 can be the number of the left two tubes homing. Your task is the output P1, P2, ..., PN value of, in order to control the robotic arm moves. Note that i = Pi actually does not need to be reversed, but still need to output Pi. [Input Format] input consists of multiple sets of test data. Each test tubes the number n (1 ≤ n ≤ 100000), t
(系统自动生成,下载前可以参看下载内容)

下载文件列表

机器排序/sort.cpp
机器排序/机器排序.doc
机器排序

相关说明

  • 本站资源为会员上传分享交流与学习,如有侵犯您的权益,请联系我们删除.
  • 搜珍网是交换下载平台,只提供交流渠道,下载内容来自于网络,除下载问题外,其它问题请自行百度。更多...
  • 本站已设置防盗链,请勿用迅雷、QQ旋风等下载软件下载资源,下载后用WinRAR最新版进行解压.
  • 如果您发现内容无法下载,请稍后再次尝试;或换浏览器;或者到消费记录里找到下载记录反馈给我们.
  • 下载后发现下载的内容跟说明不相乎,请到消费记录里找到下载记录反馈给我们,经确认后退回积分.
  • 如下载前有疑问,可以通过点击"提供者"的名字,查看对方的联系方式,联系对方咨询.

相关评论

暂无评论内容.

发表评论

*快速评论: 推荐 一般 有密码 和说明不符 不是源码或资料 文件不全 不能解压 纯粹是垃圾
*内  容:
*验 证 码:
搜珍网 www.dssz.com