Please, try EDU on Codeforces! New educational section with videos, subtitles, texts, and problems. ×

AndreiBalanici's blog

By AndreiBalanici, history, 6 weeks ago, In English,

Partitioning a natural number n in order to get the maximum product sequence of its addends.Do anyone have informations about this problem?

 
 
 
 
  • Vote: I like it
  • +2
  • Vote: I do not like it

»
6 weeks ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

Pseudocode (assume $$$n \geq 2$$$)

if (n % 3 == 0) {
  [print n/3 '3']
} else if (n % 3 == 1) {
  [print (n/3 - 1) '3' and a '4']
} else {
  [print n/3 '3' and a '2']
}