The problem is so badly stated that we have to guess what we have to do...
I can not use some functions from Symbolic Math Toolbox here! What should I do to fix it?
"Solved" problem with trivial if-else solution for all cases. The problem doesn't stated correctly. OR test cases error.
P.S. Where is dislike button>
The problem and test cases are consistent.
At time zero they order one beer. After 30 minutes they order one more beer. So, within half an hour they've ordered two beers.
After another 30 minutes they order the sum of the previous two orders, which is two beers (1+1=2). So, within two half-hours they've ordered four beers. After yet another 30 minutes they again order the sum of the previous two orders, which is now three beers (1+2=3). So, within three half-hours they've ordered seven beers. And they continue on, thenceforth always ordering the sum of the preceding two orders. For example, the following order would be five beers (2+3=5), so the cumulative total after four half-hours would be twelve beers.
This is a very famous sequence, albeit in a different context.
(It would have been better to have more text cases, though.)
Good problem, but you could add more test cases, like n = 0, which should be 1. And a higher n, 144, which should be much greater than 2 billion beers (after 3 days straight at Octoberfest, wow). Unfortunately, It is impossible to calculate the beer for all 16 to 18 days within machine precision.
I don't understand the problem, the way it is written is very confusing.
If I test this function in Matlab everything works. why does the fibonacci function dont work here?
The fibonacci() function is part of the Symbolic Math toolbox. Cody utilizes vanilla Matlab and does not currently support toolbox functions.
Fibonacci inbuilt function is not accepted!!!
The problem needs proof reading.
nice solution and comments
Given two strings, find the maximum overlap
Remove the air bubbles
Project Euler: Problem 4, Palindromic numbers
Return a list sorted by number of consecutive occurrences
Magic is simple (for beginners)
Opposite task convert binary numbers array into array of decimal numbers.
Solve expression III
Solve expression II
Get derivarive of polynomial given as vector array.
Calculate the values of a polynomial.
Find the treasures in MATLAB Central and discover how the community can help you!
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