We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Prepare
- Algorithms
- Implementation
- Chocolate Feast
- Discussions
Chocolate Feast
Chocolate Feast
Sort by
recency
|
1289 Discussions
|
Please Login in order to post a comment
int feast = n/c; int wrappers = n/c; while(wrappers >= m){ wrappers = wrappers - m + 1; feast++; } return feast;
public static int chocolateFeast(int n, int c, int m) {
int chocolateFeast(int n, int c, int m) { int bars=n/c; int wrappers=n/c; while(wrappers>=m){ int new_bar=wrappers/m; bars=bars+new_bar; wrappers=(wrappers%m)+new_bar; } return bars; } auto tinting