How Do I solve problem ADADIG on spoj?

Правка en2, от Shubham_1007, 2017-09-20 20:59:48

Problem :ADADIG I am trying to solve this , my Approach is: For a given N : 1)If it is prime —> if single digit return 1 else return 0

2)else factorize N and find all combinations of its factor and add 1s to make the digital sum equal to be N and find all permutations of it and add them all and return this. for step 2 , I am unable to figure out How do I do that efficiently?

Теги number theory, spoj adadig, #adhoc

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский Shubham_1007 2017-09-20 20:59:48 2 Tiny change: 'return 0\n2)else\n' -> 'return 0\n\n2)else\n'
en1 Английский Shubham_1007 2017-09-20 20:58:35 454 Initial revision (published)