文件名称:yuesefu
介绍说明--下载内容来自于网络,使用问题请自行百度
约瑟夫问题是个有名的问题:N个人围成一圈,从第一个开始报数,第M个将被杀掉,最后剩下一个,其余人都将被杀掉。例如N=6,M=5,被杀掉的人的序号为5,4,6,2,3。最后剩下1号。
假定在圈子里前K个为好人,后K个为坏人,你的任务是确定这样的最少M,使得所有的坏人在第一个好人之前被杀掉-Josephus problem is a well-known problem: N personal circle, starting from the first report the number of M will be killed first, the last remaining one, the rest will be killed. For example, N = 6, M = 5, the number of people killed 5,4,6,2,3. The last remaining No. 1. Assumed that the first K in circles as a good man, after the K was bad person, your task is to determine this minimum M, makes all the bad guys in a good man to be killed before
假定在圈子里前K个为好人,后K个为坏人,你的任务是确定这样的最少M,使得所有的坏人在第一个好人之前被杀掉-Josephus problem is a well-known problem: N personal circle, starting from the first report the number of M will be killed first, the last remaining one, the rest will be killed. For example, N = 6, M = 5, the number of people killed 5,4,6,2,3. The last remaining No. 1. Assumed that the first K in circles as a good man, after the K was bad person, your task is to determine this minimum M, makes all the bad guys in a good man to be killed before
(系统自动生成,下载前可以参看下载内容)
下载文件列表
yuesefu.cpp
本网站为编程资源及源代码搜集、介绍的搜索网站,版权归原作者所有! 粤ICP备11031372号
1999-2046 搜珍网 All Rights Reserved.