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:
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 understand-ability.
Remember, in most cases, you write program for humans not for machines.
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.
Hey everybody! I may have a question about this exercise! I solved it, however, it comes to my mind one question. Furthermore, I solved using the area of the circle + the area of one of its sides, considering that is a cylinder. I do not know if there are other ways to solve it, so if you could share your way with me, I would be very grateful!
Many thanks in advance!
@Raul, the way you solved it is correct. The formula remains the same however people simplify it
Code in any programming language should always be readable with as little effort as possible. But regex are often hard to read - so don't look for brevity, but for clarity.
Unless the cake isn't floating in the freezer receiving frost from all sides, then the base won't catch the cold if it is placed usually.
At first i wrote the code like the bottom of the cake needed to be frosted
I am confused because I don't think that this answer is the surface area of a cylinder.
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.
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...
Thanks to @SvenStahs, I now know why I can't achieve the minimum size. Thanks bud! And you guys need to fix this.. :(
the ans is 0, because the cake will be eaten.
I need help.I just couldn't use the expressions correctly
calculating surface area except the base area
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
simple and fun.
just tricky one.
Find the treasures in MATLAB Central and discover how the community can help you!
Select a Web
Choose a web site to get translated content where available and see local events and
offers. Based on
your location, we recommend that you select: .
You can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country
sites are not optimized for visits from your location.
Contact your local office