×

# Need help in Codeforces Carrot Cakes

 0 I am having trouble in coming up with a solution for Carrot Cakes. The editorials are provided but I can't understand how do we arrive at such a formula.. asked 24 Jun '18, 16:11 0★montycs 105●7 accept rate: 0%

 1 let's say we don't build second one. Then it's just simple to calculate TimeWithoutBuild using formula : TimeWithoutBuild = ceil(n/k)* t Now let's build the second and calculate the TimeWithBuild: as it take d unit time to build, we first add d to TimeWithBuild now we might have already baked some cakes while building the second one. So we need to subtract that cakes from n, so our remaining cakes will be n-(d/t)*k let's say this is n_rem Now our speed of baking is doubled So TimeWithBuild = d + ceil(n_rem/(2*k)) * t Now you will be good to code it yourself but nevertheless here is my solution.... Good Luck :p View Content answered 24 Jun '18, 20:46 4★meet2mky 201●3 accept rate: 28% Thanks for replying.. Can explain the last part i.e n-(d/t)*k in detail ? I don't get it.. (25 Jun '18, 15:49) montycs0★
 toggle preview community wiki:
Preview

By Email:

Markdown Basics

• *italic* or _italic_
• **bold** or __bold__
• image?![alt text](/path/img.jpg "title")
• numbered list: 1. Foo 2. Bar
• to add a line break simply add two spaces to where you would like the new line to be.
• basic HTML tags are also supported
• mathemetical formulas in Latex between \$ symbol

Question tags:

×655

question asked: 24 Jun '18, 16:11

question was seen: 119 times

last updated: 25 Jun '18, 16:07