Problem 44943. Calculate Amount of Cake Frosting
Solution Stats
Problem Comments

6 Comments
This problem is yummy! :)
Simple & interesting.
The same as the surface area of a cylinder but without calculating the area of the bottom surface (circle) of the cylinder:
Original: A=2πrh+2πr2
Modified: A=2πrh+πr2
Having finished all 15 problem just to see what is the leading solution looks like. Then I realize smaller size doesn't mean the solution is better, often it is at the price of understandability.
Remember, in most cases, you write program for humans not for machines.
Nice
If you're considering trying to get your solution size down to 10  like the leading solution  don't bother! They wrapped all their code in a regex statement so that the code size cannot be calculated anymore (the algorithm only sees the regex call, not what that regex actually does). ANY code you write like this is going to be of size 10 but is not going to be actually faster than the proper solution. Probably the exact opposite in fact.
Solution Comments

1 Comment
easy question

1 Comment
easy

2 Comments
This Problem has some info missing they did not specified for which shape we have to find surface area, I request the Creator to rectify it.
Where would you frost a cake? Give it a thought.

1 Comment
surely wrapping all the code into a regular expression, which hides it from the code size calculation algorithm of Cody, is cheating... This way you can get a size of 10 on nearly any problem. Thanks for messing up the solution chart for the rest of us...

2 Comments
unbelieveble
Good problem

1 Comment
Interesting

3 Comments
the ans is 0, because the cake will be eaten.
I need help.I just couldn't use the expressions correctly
haha

2 Comments
that's good
thanks

1 Comment
calculating surface area except the base area

1 Comment
easy

1 Comment
I do not think this exercise is correct. As one should not put frosting below the cake, the area of the cake to put frost on is the area of the circle on top of it plus the area of the "bent" rectangle on its sides. Thus:
function SA = func_frosting2(r,h)
ARectangle = pi*r*h;
ACircle = pi*r^2;
SA = ARectangle + ACircle;
I think the current solution is misleading

1 Comment
simple and fun.

1 Comment
just tricky one.
Problem Recent Solvers13122
Suggested Problems

Increment a number, given its digits
590 Solvers

402 Solvers

289 Solvers

2189 Solvers

3248 Solvers
More from this Author13
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!