当前位置:网站首页>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 )&#
边栏推荐
- Poap: the adoption entrance of NFT?
- Digital DP template
- Game 280 of leetcode week
- 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
- SAP ui5 application development tutorial 106 - how to improve the readability of SAP ui5 application routing URL trial version
- Express routing, express middleware, using express write interface
- Remote control service
- Applet live + e-commerce, if you want to be a new retail e-commerce, use it!
- [development of large e-commerce projects] performance pressure test - Performance Monitoring - heap memory and garbage collection -39
- Behind the cluster listing, to what extent is the Chinese restaurant chain "rolled"?
猜你喜欢
Playwright recording
Daily question brushing record (13)
Basic operations of database and table ----- delete index
Expose testing outsourcing companies. You may have heard such a voice about outsourcing
LeetCode周赛 + AcWing周赛(T4/T3)分析对比
phpstrom设置函数注释说明
The performance of major mainstream programming languages is PK, and the results are unexpected
Basic operation of database and table ----- phased test II
【海浪建模2】三维海浪建模以及海浪发电机建模matlab仿真
[CTF] AWDP summary (WEB)
随机推荐
A simple SSO unified login design
SAP ui5 application development tutorial 106 - how to improve the readability of SAP ui5 application routing URL trial version
【FPGA教程案例9】基于vivado核的时钟管理器设计与实现
Basic operation of database and table ----- the concept of index
Wechat applet; Gibberish generator
Great God developed the new H5 version of arXiv, saying goodbye to formula typography errors in one step, and mobile phones can also easily read literature
Introduction to redis (1)
Behind the cluster listing, to what extent is the Chinese restaurant chain "rolled"?
Pycharm professional download and installation tutorial
Hedhat firewall
抓包整理外篇——————状态栏[ 四]
Introduction to the gtid mode of MySQL master-slave replication
Redis master-slave replication cluster and recovery ideas for abnormal data loss # yyds dry goods inventory #
The performance of major mainstream programming languages is PK, and the results are unexpected
Applet live + e-commerce, if you want to be a new retail e-commerce, use it!
Yyds dry goods inventory kubernetes management business configuration methods? (08)
[untitled]
[pure tone hearing test] pure tone hearing test system based on MATLAB
26.2 billion! These universities in Guangdong Province have received heavy support
Actual combat simulation │ JWT login authentication