Home > Back-end >  Joseph problem
Joseph problem

Time:09-28


To solve the

CodePudding user response:

This is my code, can refer to:
 
# include
using namespace std;
Int main ()
{
int n;
Cout<" How many people do you have?" Cin> n;
Bool all [n].//all [0] don't
Int times=0;
For (auto & amp; A: all)
A=true;
Int c=0;
Int q;
Cout<" Out several people?" Cin> q;
Int p;
Cout<" Count up to a few out?" Cin> p;
For (int b=0; b{
While (1)
{
If (c+ + c;
The else
C=1;
If (all [c])
+ + times;
If (times % p==0)
{
All [c]=false;
Times=0;
break;
}
}
}
For (int a=1; A<=n; + + a)
Coutreturn 0;
}

CodePudding user response:

I use this app # CSDN# found have technical content of the blog and friends to seek common to "[leetcode] Joseph ring problem", gathered together at https://blog.csdn.net/weixin_44155115/article/details/105208422? Utm_source=app

CodePudding user response:

https://blog.csdn.net/abcd7038/article/details/105382017
  • Related