当前位置:网站首页>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 )&#
边栏推荐
- The performance of major mainstream programming languages is PK, and the results are unexpected
- 無心劍英譯席慕容《無怨的青春》
- Wechat applet: exclusive applet version of the whole network, independent wechat community contacts
- SAP ui5 application development tutorial 107 - trial version of SAP ui5 overflow toolbar container control introduction
- PHP 约瑟夫环问题
- Kibana installation and configuration
- Research Report on the overall scale, major producers, major regions, products and application segmentation of agricultural automatic steering system in the global market in 2022
- Global and Chinese market of optical densitometers 2022-2028: Research Report on technology, participants, trends, market size and share
- Using openpyxl module to write the binary list into excel file
- 微信小程序:独立后台带分销功能月老办事处交友盲盒
猜你喜欢
[wave modeling 1] theoretical analysis and MATLAB simulation of wave modeling
Yyds dry goods inventory [Gan Di's one week summary: the most complete and detailed in the whole network]; detailed explanation of MySQL index data structure and index optimization; remember collectio
College degree, what about 33 year old Baoma? I still sell and test, and my monthly income is 13K+
What you learned in the eleventh week
Pycharm professional download and installation tutorial
There is a new Post-00 exam king in the testing department. I really can't do it in my old age. I have
Hedhat firewall
User login function: simple but difficult
FEG founder rox:smartdefi will be the benchmark of the entire decentralized financial market
Innovation leads the direction. Huawei Smart Life launches new products in the whole scene
随机推荐
Wechat applet: new independent backstage Yuelao office one yuan dating blind box
LeetCode周赛 + AcWing周赛(T4/T3)分析对比
Database postragesq role membership
There is a new Post-00 exam king in the testing department. I really can't do it in my old age. I have
Database postragesql client connection default
实战模拟│JWT 登录认证
Hedhat firewall
[wave modeling 1] theoretical analysis and MATLAB simulation of wave modeling
Take you ten days to easily complete the go micro service series (IX. link tracking)
Express routing, express middleware, using express write interface
Yyds dry goods inventory [Gan Di's one week summary: the most complete and detailed in the whole network]; detailed explanation of MySQL index data structure and index optimization; remember collectio
Global and Chinese markets for stratospheric UAV payloads 2022-2028: Research Report on technology, participants, trends, market size and share
Expansion operator: the family is so separated
107. Some details of SAP ui5 overflow toolbar container control and resize event processing
流批一體在京東的探索與實踐
User login function: simple but difficult
微信小程序:全新独立后台月老办事处一元交友盲盒
Wechat applet; Gibberish generator
Analysis and comparison of leetcode weekly race + acwing weekly race (t4/t3)
微信小程序:微群人脉微信小程序源码下载全新社群系统优化版支持代理会员系统功能超高收益