Cody

Problem 2501. Whole Number Un-Concatenator

Solution 2546667

Submitted on 14 Jun 2020 by Nikolaos Nikolaou
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
n=12345; dig=3; ns_correct=[123 45]; assert(isequal(uncat(n,dig),ns_correct))

t = 1 2 3 4 5 s1 = 123 s2 = 45 ns = 123 45

2   Pass
n=3141592; dig=1; ns_correct=[3 141592]; assert(isequal(uncat(n,dig),ns_correct))

t = 3 1 4 1 5 9 2 s1 = 3 s2 = 141592 ns = 3 141592

3   Pass
n=271828; dig=1; ns_correct=[2 71828]; assert(isequal(uncat(n,dig),ns_correct))

t = 2 7 1 8 2 8 s1 = 2 s2 = 71828 ns = 2 71828

4   Pass
n=1618033988; dig=6; ns_correct=[161803 3988]; assert(isequal(uncat(n,dig),ns_correct))

t = 1 6 1 8 0 3 3 9 8 8 s1 = 161803 s2 = 3988 ns = 161803 3988

5   Pass
n=112358132134; dig=10; ns_correct=[1123581321 34]; assert(isequal(uncat(n,dig),ns_correct))

t = 1 1 2 3 5 8 1 3 2 1 3 4 s1 = 1.1236e+09 s2 = 34 ns = 1.0e+09 * 1.1236 0.0000