当前位置:网站首页>PHP Joseph Ring problem
PHP Joseph Ring problem
2022-07-05 01:26:00 【Know its black and accept its white】
Read the directory
Origin of the problem
It is said that the famous Jewish historian Josephus Have the following story :
After the Romans took jotapat ,39 Jews and Josephus And his friends in a cave ,39 A Jew decided to die rather than be caught by the enemy , So I decided to commit suicide ,41 Individuals in a circle , From the first 1 Individual starts counting , Count to 3 You have to kill yourself , And then count again by the next , Until everyone killed himself .
However Josephus And his friends didn't want to comply .
Start with one person , Skip over k-2 personal ( Because the first one has been crossed ), And kill No k personal .
next , Over again k-1 personal , And kill No k personal .
The process goes all the way around the circle , Until there's only one left , This man can live on .
The problem is , Given and , Where to stand at first to avoid being executed .
Josephus Ask his friend to pretend to obey first , He arranged his friend and himself in the 16 And 31 A place , So I escaped the game of death .
Problem description
Joseph Ring problem is a very classic problem :
A circle has N personal (N For uncertain numbers ),
The number of the first person is 0 perhaps 1( Both can , See how your program is written )&#
边栏推荐
- Global and Chinese markets of emergency rescue vessels (errv) 2022-2028: Research Report on technology, participants, trends, market size and share
- 微信小程序;胡言乱语生成器
- Main window in QT application
- Pandora IOT development board learning (RT thread) - Experiment 4 buzzer + motor experiment [key external interrupt] (learning notes)
- Redis(1)之Redis简介
- POAP:NFT的采用入口?
- 每日刷题记录 (十三)
- 微信小程序:星宿UI V1.5 wordpress系统资讯资源博客下载小程序微信QQ双端源码支持wordpress二级分类 加载动画优化
- BGP comprehensive experiment
- Discrete mathematics: reasoning rules
猜你喜欢
![[wave modeling 1] theoretical analysis and MATLAB simulation of wave modeling](/img/c4/46663f64b97e7b25d7222de7025f59.png)
[wave modeling 1] theoretical analysis and MATLAB simulation of wave modeling

Single step debugging of master data reading of SAP commerce cloud products

Actual combat simulation │ JWT login authentication
![Grabbing and sorting out external articles -- status bar [4]](/img/88/8267ab92177788ac17ab665a90b781.png)
Grabbing and sorting out external articles -- status bar [4]

I was beaten by the interviewer because I didn't understand the sorting

Wechat applet: exclusive applet version of the whole network, independent wechat community contacts

The performance of major mainstream programming languages is PK, and the results are unexpected

107. Some details of SAP ui5 overflow toolbar container control and resize event processing

DOM basic syntax

Poap: the adoption entrance of NFT?
随机推荐
Introduction to the gtid mode of MySQL master-slave replication
Global and Chinese markets of radiation linear accelerators 2022-2028: Research Report on technology, participants, trends, market size and share
Query for Boolean field as "not true" (e.g. either false or non-existent)
Wechat applet; Gibberish generator
JS implementation determines whether the point is within the polygon range
Can financial products be redeemed in advance?
How to use words to describe breaking change in Spartacus UI of SAP e-commerce cloud
Blue Bridge Cup Square filling (DFS backtracking)
小程序容器技术与物联网 IoT 可以碰撞出什么样的火花
微信小程序:微群人脉微信小程序源码下载全新社群系统优化版支持代理会员系统功能超高收益
【FPGA教程案例10】基于Verilog的复数乘法器设计与实现
Playwright recording
Wechat applet: wechat applet source code download new community system optimized version support agent member system function super high income
MySQL REGEXP:正则表达式查询
微信小程序:独立后台带分销功能月老办事处交友盲盒
【CTF】AWDP总结(Web)
SAP ui5 application development tutorial 107 - trial version of SAP ui5 overflow toolbar container control introduction
[FPGA tutorial case 10] design and implementation of complex multiplier based on Verilog
[flutter topic] 64 illustration basic textfield text input box (I) # yyds dry goods inventory #
Talking about JVM 4: class loading mechanism