Get Time

   Problem Statement  

 Problem Statement for Workshop

Problem Statement


You work in a workshop which makes garden instruments from metal. At the end of each working day there remains a pile of scrap metal that cannot be used to make anything useful. Because you dislike the idea of throwing things away (even scrap metal), you decide to utilize this metal to make some triangular picture frames that can be sold at the local market.

Given a int[] pieces where each element represents the length of a straight metallic piece, return the number of possible different picture frames that can be made from those pieces. Two picture frames are considered to be identical if each of their corresponding sides is equal in length. If no picture frames can be created from pieces then return 0.



Method signature:int pictureFrames(int[] pieces)
(be sure your method is public)


-A triangle can be formed if, and only if, for every pair of its sides the sum of that pair is longer than the third side.


-pieces will have between 0 and 50 elements inclusive.
-Each element in pieces will be between 1 and 10000 inclusive.
-pieces will not have any repeated elements.


Returns: 3
We can form picture frames with the following sides: {2, 3, 4}, {2, 4, 5} and {3, 4, 5}. So we can form 3 different picture frames.
Returns: 0
8 + 5 is longer than 3 and 8 + 3 is longer than 5, but 5 + 3 is not longer than 8. Thus we cannot form a single picture frame from these pieces.
Returns: 7
Returns: 43
Returns: 0
We cannot form any picture frames with just one piece of metal.

This problem statement is the exclusive and proprietary property of TopCoder, Inc. Any unauthorized use or reproduction of this information without the prior written consent of TopCoder, Inc. is strictly prohibited. (c)2010, TopCoder, Inc. All rights reserved.

This problem was used for:
       Single Round Match 166 Round 1 - Division II, Level One