On Monday, 10 April 2017 11:07:48 UTC+8, Zachary wrote:
> Another way you can solve this problem without making use of any data
> structures (as is done in the analysis solution) is with the following loop
> (with variables n and k as in the problem):
>
> while(k != 1) {
> if(k % 2 == 0)
> n = n / 2; //ceil
> else
> n = (n-1) / 2; //floor
> k = k / 2;
> }
>
> After which your solutions would be n/2 and (n-1)/2.
Hi,
I also found this solution. I wrote a small article about it :
https://vincent.404.taipei/2017/04/09/gcj2017-bathroom-stalls/
--
You received this message because you are subscribed to the Google Groups
"Google Code Jam" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/google-code/71cf590b-4de6-46eb-86ef-0706d70ed638%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.