当前位置:网站首页>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 )&#
边栏推荐
- SAP ui5 application development tutorial 107 - trial version of SAP ui5 overflow toolbar container control introduction
- Basic operations of database and table ----- create index
- Roads and routes -- dfs+topsort+dijkstra+ mapping
- Introduction to the gtid mode of MySQL master-slave replication
- [development of large e-commerce projects] performance pressure test - Performance Monitoring - heap memory and garbage collection -39
- Actual combat simulation │ JWT login authentication
- Global and Chinese market of nutrient analyzer 2022-2028: Research Report on technology, participants, trends, market size and share
- BGP comprehensive experiment
- Detailed explanation of multi-mode input event distribution mechanism
- Can financial products be redeemed in advance?
猜你喜欢

【CTF】AWDP总结(Web)

Basic operation of database and table ----- the concept of index
![[CTF] AWDP summary (WEB)](/img/4c/574742666bd8461c6f9263fd6c5dbb.png)
[CTF] AWDP summary (WEB)
![Grabbing and sorting out external articles -- status bar [4]](/img/88/8267ab92177788ac17ab665a90b781.png)
Grabbing and sorting out external articles -- status bar [4]

Wechat applet: Xingxiu UI v1.5 WordPress system information resources blog download applet wechat QQ dual end source code support WordPress secondary classification loading animation optimization

SAP ui5 application development tutorial 107 - trial version of SAP ui5 overflow toolbar container control introduction

流批一体在京东的探索与实践

FEG founder rox:smartdefi will be the benchmark of the entire decentralized financial market

Wechat applet: independent background with distribution function, Yuelao office blind box for making friends

LeetCode周赛 + AcWing周赛(T4/T3)分析对比
随机推荐
Discrete mathematics: propositional symbolization of predicate logic
C语音常用的位运算技巧
Inventory of more than 17 typical security incidents in January 2022
How to safely eat apples on the edge of a cliff? Deepmind & openai gives the answer of 3D security reinforcement learning
Four pits in reentrantlock!
Global and Chinese market of nutrient analyzer 2022-2028: Research Report on technology, participants, trends, market size and share
Pandora IOT development board learning (RT thread) - Experiment 4 buzzer + motor experiment [key external interrupt] (learning notes)
Wechat applet: wechat applet source code download new community system optimized version support agent member system function super high income
Classification of performance tests (learning summary)
[FPGA tutorial case 10] design and implementation of complex multiplier based on Verilog
微信小程序;胡言乱语生成器
[microprocessor] VHDL development of microprocessor based on FPGA
C basic knowledge review (Part 3 of 4)
Database postragesq role membership
Arbitrum: two-dimensional cost
微信小程序:独立后台带分销功能月老办事处交友盲盒
[wave modeling 3] three dimensional random real wave modeling and wave generator modeling matlab simulation
Poap: the adoption entrance of NFT?
Logstash、Fluentd、Fluent Bit、Vector? How to choose the appropriate open source log collector
107. Some details of SAP ui5 overflow toolbar container control and resize event processing