for real numbers N(n<=2000), Find the longest real number array a[1], a[2], ..., a[m] such that the sum and product of that real number array is equal to N: a[1]+a[2]+...+a[m]=a[1].a[2]. ... . a[m] = N
here my code: http://ideone.com/2CsXul but it WA if n>=100
Sorry this is my first time writing blog
I haven't looked at your code, but I think you can do this : First add all the prime factors of the number to the array, then add 1s to the array until the sum of the array is equal to N. Like for example , 84 the answer would be [2,2,3,7, and seventy 1s].
but a[1], a[2], ... is float
Can you give some sample test cases ?
ok N=10 out : 1.127016653792583 1.148715065833816 1.180378775426093 1.231912164917117 1.336027126931952 3.975950213098439
Ok , I will think about. I will reply when I get a solution.
thank you very much
Can you provide the problem link, please?
It is written in Vietnamese, can you read it?