登录
首页 » 算法 » 一个求解Josephus问题的函数

一个求解Josephus问题的函数

于 2022-01-27 发布 文件大小:250.37 kB
0 247
下载积分: 2 下载次数: 1

代码说明:

  #include #include #define NULL 0 #include typedef struct Lnode {  int data;  struct Lnode *next; }Josephus; void CreateList(Josephus*&L,int n)//建立循环链表 {  int i;  Josephus *p,*s;  s=(Josephus*)malloc(sizeof(Josephus));  s->data=1;  L=p=s;  for(i=2;idata=i;  p->next=s;  p=s;  }  p->next=L; } void DeleteList(Josephus*&L,Josephus*p,Josephus*q) {  q->next=p->next;  free(p); } void Josephus1(Josephus*&L,int s,int m)

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

发表评论

0 个回复

  • issue a travel home to travel home to drive a car with the minimum of cost yi us...
    旅行家问题 一个旅行家想驾驶汽车以最少的费yi 用从一个城市到另一个城市(假设出发时油箱是空的)。给定两个城市之间的距离为D1、汽车油箱的容量为C(以升为单位),每升汽油能行驶的距离为 D2,出发点每升汽油价格P和沿途油站数N(N可以为零),油站i离出发点距离Di,每升汽油价格Pi(i=1,2...N)。计算结果四舍五入至小数点后两位。 如果无法到达目的地,则输出“No Solution"。-issue a travel home to travel home to drive a car with the minimum of cost yi used from one city to another city (assuming starting at the fuel tank was empty). Given the two cities for the distance between D1, car fuel tank capacity of the C (in liters) per liter petrol traveling distance to the D2, the starting point liter gasoline prices P and several petrol stations along the N (N can be zero), PFS i distance from the starting point Di per liter Steam oil prices Pi (i = 1,2 ... N). Calculation results rounded to two decimal places. If unable to reach their destination, the export of "No Solution."
    2023-09-07 00:25:03下载
    积分:1
  • 2009
    2009
    2022-03-15 08:15:45下载
    积分:1
  • 光流运动检测源程序
    应用光流法对目标进行检测和估计。亲测好用,效果很不错
    2022-09-06 17:00:03下载
    积分:1
  • 实现一个投票功能
    输入投票的人名,实现记票功能,最后调试代码,功能均已实现。可以实现每个候选人的投票数,以及无效票数
    2022-01-26 01:14:28下载
    积分:1
  • 遗传
    分析了遗传算法的初始化,交叉变异等过程;通过实际例子,对遗传算法在计算目标函数值,将二进制编码转化为十进制数,计算个体的适应值几个方面的应用进行了详细分析。对初学者了解遗传算法具有很好的帮助。
    2022-08-02 17:38:53下载
    积分:1
  • 这三段C程序能够产生符合高斯、瑞利和泊松分布的随机数,并且包括关于它们的说明文档...
    这三段C程序能够产生符合高斯、瑞利和泊松分布的随机数,并且包括关于它们的说明文档-These three paragraphs C program to generate consistent with Gaussian, Rayleigh and Poisson distribution of random numbers, and includes documentation about them
    2022-01-31 02:36:39下载
    积分:1
  • dobbs编缉器升级版的C语言源程序
    dobbs编缉器升级版的C语言源程序-Dobbs editor for an updated version of the C language source
    2022-10-09 14:30:03下载
    积分:1
  • 飞船相对测站的位置矢量单位矢量在赤道坐标系中的三个分量...
    计算飞船相对测站的位置矢量单位矢量在赤道坐标系中的三个分量-Calculation of the spacecraft relative position vector of the station unit vector in the equatorial coordinate system of the three subscales
    2022-12-13 04:10:03下载
    积分:1
  • 词频统计C++
    给定一篇英文文本,要求提取其中所有的单词并计算其一元词频(某个单词出现的次数)和二元词频(两个连续单词出现的次数) 举例:I have an apple . And you have an apple , too . 输出: i--1,have--2,an--2,apple--2,and--2,you--1,too--1 an apple--2   
    2023-04-02 15:30:05下载
    积分:1
  • CUDA_match
    基于CUDA库进行图像间的匹配,很好的入门学习代码。CUDA是Compute Unified Device Architecture的缩写。 代码中主要包含CUDA的基本功能库,图像立体匹配源代码,图像处理源代码和模板匹配源代码等,还包含了测试数据。
    2022-01-24 09:49:57下载
    积分:1
  • 696516资源总数
  • 106914会员总数
  • 0今日下载