Page 1 of 1

13039 - Fibonacci Triangle

Posted: Wed Dec 30, 2015 9:15 am
by dibery
Didn't quite understand this problem.
Should all sticks be used?

In the first sample input, 1 6 2
Does it mean "2 3 3 3 3 3 3 5 5" cm sticks?
I found
3 3 2
5 5 3
5 5 2
3 3 5, 4 possible combinations.
Why the answer is 3?

Thanks.

Re: 13039 - Fibonacci Triangle

Posted: Thu Jan 07, 2016 7:07 pm
by dibery
OK, I figured it out, and I'll explain a little bit more in details.

1. For input "1 6 2", we have sticks of lengths of "2 3 3 3 3 3 3 5 5", 9 sticks in total.
2. We have to make as many triangles as possible.
3. Each triangle consists of 3 sticks, and no stick should be used more than once.

So for the sample input, we can form 3 triangles in the following way:
2 3 3
3 3 5
3 3 5
using all sticks and we form 3.

Other combinations may also exist, and some sticks may never be used.