http://ideone.com/MSLXT
The constraints are so less that you can brute force the solution..N<100. My solution is O(N^3) On Thu, Jun 30, 2011 at 1:13 AM, harshit pahuja <hpahuja.mn...@gmail.com> wrote: > http://en.wikipedia.org/wiki/Josephus_problem > here there is an explanation of the derivation of josephus which is nt very > clear........can some1 explain it plzz > > On Wed, Jun 29, 2011 at 12:40 PM, harshit pahuja <hpahuja.mn...@gmail.com> > wrote: >> >> Hello guys... >> http://www.spoj.pl/problems/POCRI/ >> >> this problem is using a variant of josephus problem. >> in josephus we for given n persons in a circle we start killing every kth >> person and last person remaining is the survivor......kth 2kth 3kth.......so >> on >> i solved it using f(n,k)=(f(n-1,k)+k)%m nd dp... >> nw in its variant which is the spoj problem we have to kill evert kth >> person but we have to start by killing 1st den (k+1)th den(2k+1)th so on >> i m nt able to modify the above problem........ >> plzz help >> >> -- >> HARSHIT PAHUJA >> M.N.N.I.T. >> ALLAHABAD >> >> > > > > -- > HARSHIT PAHUJA > M.N.N.I.T. > ALLAHABAD > > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to algogeeks@googlegroups.com. > To unsubscribe from this group, send email to > algogeeks+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- Thanks and regards Rizwan A Hudda http://sites.google.com/site/rizwanhudda2 -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.