当前位置:网站首页>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 )&#
边栏推荐
- Digital DP template
- Introduction to redis (1)
- 微信小程序;胡言乱语生成器
- Playwright recording
- Detailed explanation of multi-mode input event distribution mechanism
- Call Huawei order service to verify the purchase token interface and return connection reset
- Introduction to the gtid mode of MySQL master-slave replication
- 流批一体在京东的探索与实践
- Nebula Importer 数据导入实践
- Global and Chinese market of veterinary thermometers 2022-2028: Research Report on technology, participants, trends, market size and share
猜你喜欢
After reading the average code written by Microsoft God, I realized that I was still too young
Express routing, express middleware, using express write interface
Basic operation of database and table ----- the concept of index
Postman automatically fills headers
FEG founder rox:smartdefi will be the benchmark of the entire decentralized financial market
Actual combat simulation │ JWT login authentication
[wave modeling 1] theoretical analysis and MATLAB simulation of wave modeling
MySQL REGEXP:正则表达式查询
Four pits in reentrantlock!
Single step debugging of master data reading of SAP commerce cloud products
随机推荐
【纯音听力测试】基于MATLAB的纯音听力测试系统
Redis master-slave replication cluster and recovery ideas for abnormal data loss # yyds dry goods inventory #
微信小程序;胡言乱语生成器
[CTF] AWDP summary (WEB)
Discrete mathematics: Main Normal Form (main disjunctive normal form, main conjunctive normal form)
Express routing, express middleware, using express write interface
资深测试/开发程序员写下无bug?资历(枷锁)不要惧怕错误......
Yyds dry goods inventory kubernetes management business configuration methods? (08)
Maximum number of "balloons"
Introduction to redis (1)
Digital DP template
JS implementation determines whether the point is within the polygon range
Roads and routes -- dfs+topsort+dijkstra+ mapping
Pycharm professional download and installation tutorial
Wechat applet; Gibberish generator
Database postragesq peer authentication
Discrete mathematics: reasoning rules
JS implementation determines whether the point is within the polygon range
PHP wechat official account development
The server time zone value ‘� й ��� ʱ 'is unrecognized or representatives more than one time zone【