Butun olasi durumlara bakildi ve sadece 12 durum oldugu teyit edildi.
ClearAll["Global`*"]
sign[n_] := Permutations[Join @@ {ConstantArray[-1, 9], ConstantArray[1, 9]}, {n}];
count[m_, k_] := Module[{},
s = Range[k, 9];
list = TakeList[s, #] & /@ Join @@ Permutations /@ IntegerPartitions[Length@s];
list2 = GatherBy[Map[FromDigits, list, {2}], Length];
list3 =
Prepend[#, m] & /@ Flatten[Table[
Outer[Times, list2[[n]], sign[n], 1], {n, Length@list2}], 2];
Extract[list3, Position[Total /@ list3, 100]]]
In[4]:= count[123, 4]
Out[4]= {{123, -45, -67, 89}, {123, 45, -67, 8, -9}, {123, 4, -5,
67, -89}, {123, -4, -5, -6, -7, 8, -9}}
In[5]:= count[-123, 4]
Out[5]= {}
In[6]:= count[12, 3]
Out[6]= {{12, 3, -4, 5, 67, 8, 9}, {12, -3, -4, 5, -6, 7, 89}, {12, 3,
4, 5, -6, -7, 89}}
In[7]:= count[-12, 3]
Out[7]= {}
In[8]:= count[1, 2]
Out[8]= {{1, 23, -4, 56, 7, 8, 9}, {1, 23, -4, 5, 6, 78, -9}, {1, 2,
34, -5, 67, -8, 9}, {1, 2, 3, -4, 5, 6, 78, 9}}
In[9]:= count[-1, 2]
Out[9]= {{-1, 2, -3, 4, 5, 6, 78, 9}}