13039 - Fibonacci Triangle

All about problems in Volume 130. If there is a thread about your problem, please use it. If not, create one with its number in the subject.
Post Reply
dibery
Learning poster
Posts: 76
Joined: Sat Feb 23, 2013 4:16 pm
Location: Taiwan, Taipei
Contact:

13039 - Fibonacci Triangle

Post by dibery » Wed Dec 30, 2015 9:15 am

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.
Life shouldn't be null.

dibery
Learning poster
Posts: 76
Joined: Sat Feb 23, 2013 4:16 pm
Location: Taiwan, Taipei
Contact:

Re: 13039 - Fibonacci Triangle

Post by dibery » Thu Jan 07, 2016 7:07 pm

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.
Life shouldn't be null.

Post Reply

Return to “Volume 130 (13000-13099)”