Sum of all Permutations

Go down

Sum of all Permutations

Post  prani on Tue Sep 16, 2008 11:18 am

you are given a number n
you are to give the sum of all possible unique permutations
Example
0)


157
Returns: 2886
We have: 157 + 175 + 517 + 571 + 715 + 751 = 2886
1)

313
Returns: 777
We have: 133 + 313 + 331 = 777
2)

1234
Returns: 66660

3)

5
Returns: 5

4)

54321
Returns: 3999960

5)

99999
Returns: 99999

problem source SRM 252 topcoder

prani

Posts : 15
Join date : 2008-08-12

View user profile

Back to top Go down

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum