You are viewing a single comment's thread. Return to all comments →
@pankaj113, You can simplify/reduce your code by moving this line
int ex_chocs = wrapper / m;
inside while loop, like so:
while(wrapper >= m) { int ex_chocs = wrapper / m; wrapper = ex_chocs + wrapper % m; chocs += ex_chocs; } System.out.println(chocs);
@cesarjom Elegant and straight-forward. Thanks for sharing.
just th tweak i needed
can be further simplified
while(w>=m){ chocs+=w/m; w=w/m+(w%m); }
Chocolate Feast
You are viewing a single comment's thread. Return to all comments →
@pankaj113, You can simplify/reduce your code by moving this line
inside while loop, like so:
@cesarjom Elegant and straight-forward. Thanks for sharing.
just th tweak i needed
can be further simplified