Cody

Solution 1945314

Submitted on 22 Sep 2019 by Augusto Mazzei
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
assert(isequal(symmetry(27),3))

a = 2 7 08 30 y = 30 a = 3

2   Pass
assert(isequal(symmetry(801),0))

a = 8 0 1 001 y = 0 0 1 001 801 y = 801 a = 0

3   Pass
assert(isequal(symmetry(900),100))

a = 9 0 0 a = 100

4   Pass
assert(isequal(symmetry(88887),1))

a = 8 8 8 8 7 00008 00088 00888 08888 88888 y = 88888 a = 1

5   Pass
assert(isequal(symmetry(1234567),65433))

a = 1 2 3 4 5 6 7 0000008 0000080 0000800 0008000 0038000 0300000 1300000 y = 1300000 a = 65433

6   Pass
assert(isequal(symmetry(34567890),3432110))

a = 3 4 5 6 7 8 9 0 y = 0 0 0 0 0 0 0 0 00000000 00000100 00001000 00008000 00080000 00800000 08000000 38000000 y = 38000000 a = 3432110

7   Pass
format long g x=ceil(1e9*rand); j=389e9+x assert(isequal(8e11-symmetry(j),j))

j = 389449984827 a = 3 8 9 4 4 9 9 8 4 8 2 7 000000000008 000000000030 000000000830 000000008000 000000088000 000001000000 y = 0 0 0 0 0 0 0 0 0 0 0 0 000000000000 000080000000 000800000000 010000000000 100000000000 800000000000 y = 800000000000 a = 410550015173

8   Pass
format long g x=ceil(1e10*rand); j=889e10+x v=symmetry(j); assert(isequal(1e13-v,j))

j = 8894558884479 a = 8 8 9 4 5 5 8 8 8 4 4 7 9 a = 1105441115521

9   Pass
x=2^40-1; assert(isequal(symmetry(symmetry(symmetry(symmetry(x)))),7775))

a = 1 0 9 9 5 1 1 6 2 7 7 7 5 0000000000008 0000000000080 0000000000800 0000000008000 0000000030000 0000000800000 0000001800000 0000011800000 0000800000000 0010000000000 y = 0 0 0 0 0 0 0 0 0 0 0 0 0 0000000000000 0100000000000 1100000000000 y = 1100000000000 a = 488372225 a = 4 8 8 3 7 2 2 2 5 000000008 000000030 000000300 000003000 000080000 000380000 008380000 088380000 800000000 y = 800000000 a = 311627775 a = 3 1 1 6 2 7 7 7 5 000000008 000000080 000000800 000008000 000030000 000800000 001800000 011800000 311800000 y = 311800000 a = 172225 a = 1 7 2 2 2 5 000008 000030 000300 003000 080000 180000 y = 180000 a = 7775