URI Online Judge | 1030 Flavious Josephus Legend

This is level 3 problem so will do it later. But this video will help for  sure.