Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static int saveThePrisoner(int p, int c, int s) {
- if (p>c+s)
- return (c+s)-1;
- int res=c%p;
- if (s!=0)
- res+=s-1;
- return res;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement