当前位置:网站首页>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 )&#
边栏推荐
- La jeunesse sans rancune de Xi Murong
- MySQL REGEXP:正则表达式查询
- The server time zone value ‘� й ��� ʱ 'is unrecognized or representatives more than one time zone【
- Analysis and comparison of leetcode weekly race + acwing weekly race (t4/t3)
- Playwright recording
- Wechat applet: new independent backstage Yuelao office one yuan dating blind box
- 线上故障突突突?如何紧急诊断、排查与恢复
- 【微处理器】基于FPGA的微处理器VHDL开发
- Chia Tai International Futures: what is the master account and how to open it?
- 【大型电商项目开发】性能压测-性能监控-堆内存与垃圾回收-39
猜你喜欢

Take you ten days to easily complete the go micro service series (IX. link tracking)

ROS command line tool

Senior Test / development programmers write no bugs? Qualifications (shackles) don't be afraid of mistakes

多模输入事件分发机制详解

【大型电商项目开发】性能压测-性能监控-堆内存与垃圾回收-39

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

每日刷题记录 (十三)
![抓包整理外篇——————状态栏[ 四]](/img/88/8267ab92177788ac17ab665a90b781.png)
抓包整理外篇——————状态栏[ 四]

Express routing, express middleware, using express write interface

Blue Bridge Cup Square filling (DFS backtracking)
随机推荐
JS implementation determines whether the point is within the polygon range
Roads and routes -- dfs+topsort+dijkstra+ mapping
Global and Chinese markets for stratospheric UAV payloads 2022-2028: Research Report on technology, participants, trends, market size and share
Grabbing and sorting out external articles -- status bar [4]
Implementation steps of master detail detail layout mode of SAP ui5 application
微信小程序:星宿UI V1.5 wordpress系统资讯资源博客下载小程序微信QQ双端源码支持wordpress二级分类 加载动画优化
[wave modeling 3] three dimensional random real wave modeling and wave generator modeling matlab simulation
107. Some details of SAP ui5 overflow toolbar container control and resize event processing
What happened to those who focused on automated testing?
【微处理器】基于FPGA的微处理器VHDL开发
[untitled]
【FPGA教程案例10】基于Verilog的复数乘法器设计与实现
抓包整理外篇——————状态栏[ 四]
After reading the average code written by Microsoft God, I realized that I was still too young
To sort out messy header files, I use include what you use
Basic operations of database and table ----- create index
Single step debugging of master data reading of SAP commerce cloud products
Jcenter () cannot find Alibaba cloud proxy address
[development of large e-commerce projects] performance pressure test - Performance Monitoring - heap memory and garbage collection -39
If the consumer Internet is compared to a "Lake", the industrial Internet is a vast "ocean"