write c^3 as sum of two squares a^2+b^2. a and b must be integer and greater than zero.
5^3 = 2^2 + 11^2
5^3 = 5^2 + 10^2
10^3 = 10^2 + 30^2
10^3 = 18^2 + 26^2
sort output matrix so that each row and first column is in ascending order.
Last test case is wrong. Does not catch 500^3 == 1160^2 + 11120^2 and 500^3 == 2000^2 + 11000^2 .
First case is also wrong: 1^3 = 1^2 + 0^2. The problem doesn't specify positive numbers, so it is a valid solution. (If you *really* want to open a can of worms, a and b don't have to be integers, or even real numbers according to the test suite!)
You are right James. I have add some sentences to problem definition.
Test 12: There are two solutions missing [1160 11120; 2000 11000].
Thanks T. Dunker, I have corrected the mistake
Flip the main diagonal of a matrix
How many trades represent all the profit?
Create a two dimensional zero matrix
Determine the square root
Write out numbers in words
Repeat string n times - 2
Bridge and Torch Problem - Probability
Go back n times
Get Next Combination
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