登录
首页 » Windows开发 » 编号为1,2,…,n的n个人按顺时针方向围坐一圈,每人持有一个密码(正整数),一开始人选一个正整数作为报数上限m,从第一个人开始按顺时针方向从自1开始顺序报数,...

编号为1,2,…,n的n个人按顺时针方向围坐一圈,每人持有一个密码(正整数),一开始人选一个正整数作为报数上限m,从第一个人开始按顺时针方向从自1开始顺序报数,...

于 2022-01-24 发布 文件大小:1.41 kB
0 188
下载积分: 2 下载次数: 1

代码说明:

编号为1,2,…,n的n个人按顺时针方向围坐一圈,每人持有一个密码(正整数),一开始人选一个正整数作为报数上限m,从第一个人开始按顺时针方向从自1开始顺序报数,报道m时停止报数。报m的人出列,将他的密码作为新的m值,从他的顺时针方向上的下一个人开始重新从1报数,如此下去,直至所有人全部出列为止,设计一个程序求出出列顺序。采用单向循环链表模拟此过程,按照出列的顺序印出各人的编号测试数据:m的初值为20;n=7,7个人的密码依次为:3,1,7,2,4,8,4,首先m的值为6(正确的出列顺序应为6,1,4,7,2,3,5)-No. 1, 2, ..., n n clockwise direction by individuals sitting around a circle, each holding a password (positive integers), a candidate started as a positive integers m ceiling on the number of reported from the first individuals to embark on the clockwise direction from the start sequence from a few newspaper reports m reportedly stopped a few. M reported out of the list of his password as a new value m, from the clockwise direction on the next re-started from a few reported so on, until all out all out, the design of a procedure sought out the order out. Listless one-cycle simulation process and follow the sequence shown in the numbers printed each test data : m for the initial 20; N = 7,7 personal passwords were : 3,1,7,2,4,8

下载说明:请别用迅雷下载,失败请重下,重下不扣分!

发表评论

0 个回复

  • 696518资源总数
  • 104269会员总数
  • 31今日下载