文件名称:change

  • 所属分类:
  • 数学计算/工程计算
  • 资源属性:
  • [C/C++] [源码]
  • 上传时间:
  • 2014-04-29
  • 文件大小:
  • 13kb
  • 下载次数:
  • 0次
  • 提 供 者:
  • S*
  • 相关连接:
  • 下载说明:
  • 别用迅雷下载,失败请重下,重下不扣分!

介绍说明--下载内容均来自于网络,请自行研究使用

队列程序:n个士兵的编号分别为1,2,3,…,n,每次站队时长官都是要求n个士兵从排头到排尾依次是编号为1,2,3…,n的士兵。如果次序乱了,长官很不高兴,后果会很严重。

有一次士兵按编号次序刚刚站好队,突然长官下令让所有士兵立刻回宿舍拿水壶,要去执行一个临时任务,由于时间紧张,慌乱的士兵们拿到水壶回来后,有的没能站到自己应该站的位置。

长官不高兴了,于是下令让士兵们通过两两交换位置的方法按原来次序站好,并且规定:每一次交换位置,只能是排头的人和除排头外的任一个位置的人交换。现在告诉你士兵们的队形,问最少交换多少次能恢复到1,2,3,。。。,n的顺序。-Queue program: n soldiers were numbered 1,2,3, ..., n, each time stand n soldiers Executive is required from the head to the tail followed by numbered rows 1,2,3 ..., n soldiers . If you order in chaos, sir very unhappy consequences will be very serious. Once the order by number of soldiers just stand a good team, suddenly Executive ordered that all the soldiers immediately take the kettle back to the dorm, going to perform a temporary task, due to the time constraints, panic soldiers came back to get the kettle, and some could not stand to they should stop position. Executive unhappy, then ordered the soldiers to swap positions through twenty-two method according to the original order stand, and states: every exchange position, only the first row of the first row and the addition of either a foreign exchange position of the person. Now tell your soldiers in formation, and asked how many times the minimum exchange can be restored to 1,2,3,. . . , N for the order.
(系统自动生成,下载前可以参看下载内容)

下载文件列表





change

......\change.c

......\change.docx

相关说明

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

相关评论

暂无评论内容.

发表评论

*主  题:
*内  容:
*验 证 码:

源码中国 www.ymcn.org