The question I’m talking about is [Chef & Cakes] (https://www.codechef.com/QFUN2020/problems/CHEFCAKE/). I want to know the answer for the test case : 1 1 1 1 7 (Where N = 5) . I’m Confused as i tried the two accepted solution logic and ended up with two different answers that were accepted. Can someone guide me with the correct answer.

Can you post about solutions which gave different answers? Answer for you tc is 2933304 if each digit is considered different or 122221 if same digits are considered same. This thing is not mentioned in the Problem.

BTW, Here’s a simple solution-

## Click

```
import math
t=int(input())
for _ in range(t):
n=int(input())
arr=[int(x) for x in input().split()]
s=sum(arr)
f=math.factorial(n-1)
ans=(s*f*((10**n)-1))//9
print(ans)
```

Why the editorial tag though? It is when you’re posting an editorial.

[1] https://www.codechef.com/viewsolution/35762417

[2] https://www.codechef.com/viewsolution/35754502

Okay, seems like test data was weak.

I have a doubt. It is not given in Problem Statement that we have to consider same digits as same or different.

Say 1 1

Do we have to consider 11 once or twice? That is not given the statement.

That’s exactly what I’m thinking because when i did this manually i got 122221 as result.

Maybe there were no test cases with repetitions in internal test data.

I guess for this statement same digits are considered different because if they are considered same than 2933304 such a large number wouldn’t be possible and in that case (if treated same it would be 122221).

Exactly!

Now, chef cook N number of cake and number of layers for every cake is different.

your test case is invalid under the given conditions