Cody

Problem 44786. Lunar Arithmetic (Multiplication)

Solution 2765431

Submitted on 1 Aug 2020
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Pass
x = 15866; y = 147; assert(isequal(lunarMultiplication(x,y),1145766))

vb = 0 0 1 5 7 6 6 0 1 4 4 4 4 0 1 1 1 1 1 0 0 vb = 0 0 1 0 1 1 1 4 1 5 4 1 7 4 1 6 4 0 6 0 0 lunarMult = 1145766

2   Fail
x = 169; y = 248; assert(isequal(lunarMultiplication(x,y),12468))

vb = 0 0 1 6 8 0 2 4 4 0 2 2 2 0 0 vb = 0 0 2 0 2 2 1 4 2 6 4 0 8 0 0 lunarMult = 22468

Assertion failed.

3   Pass
x = 7; y = 4; assert(isequal(lunarMultiplication(x,y),4))

4   Pass
x = 78; y = 4; assert(isequal(lunarMultiplication(x,y),44))

5   Pass
x = 7799123; y = 109; assert(isequal(lunarMultiplication(x,y),117799123))

vb = 0 0 7 7 9 9 1 2 3 0 1 0 0 0 0 0 0 0 1 1 1 1 1 1 1 0 0 vb = 0 0 1 0 1 1 7 0 1 7 0 1 9 0 1 9 0 1 1 0 1 2 0 0 3 0 0 lunarMult = 117799123

Suggested Problems

More from this Author59