Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Magic Sticksfixed lengthNote:INPUTNSecond line containNs L12NOUTPUT Ankur has N magic sticks, each of some length. All magic sticks are of and cannot be broken. Now

Magic Sticksfixed length Note: INPUT NSecond line contain Ns L12NOUTPUT

Ankur has N magic sticks, each of some length. All magic sticks are of and cannot be broken. Now Ankur wants to build a square using exactly 6 of those magic sticks.Now Ankur wonders in how many ways he can build a square using exactly 6 magic sticks. Help him to find the number of ways.

Two ways are considered different if they use at least one different stick.

The first line contains an integer, denoting the number of sticks.

space seperated integer, L, ...., L denoting length of magic sticks.

Output an integer representing the number of ways that 6 magic sticks can be used to make as square.

 

CONSTRAINTS

 

6≤N≤3000

 

1≤Li≤10^7

 

EXPLANATION OF SAMPLE

 

Sample input has 8 sticks of lengths 4,5,1,5,1,9,4,5, respectively. There are 3 ways of making a square using of combination of 6 of these sticks.

Combination 1: Stick No. 1, 2, 3, 4, 5 and 7

Combination 2: Stick No. 1, 3, 4, 5, 7 and 8

Combination 3: Stick No. 1, 2, 3, 5, 7 and 8

 

Hence, the output for this sample case is 3.

 

Sample Input

 

8

4 5 1 5 1 9 4 5

 

Sample Output

 

3

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Management Accounting For Decision Makers

Authors: Dr Peter Atrill, Eddie McLaney

6th Edition

0273731521, 9780273731528

More Books

Students also viewed these Accounting questions

Question

Explain how to change negative self-talk into positive self-talk.

Answered: 1 week ago

Question

5 What are the ongoing challenges for HRM?

Answered: 1 week ago

Question

4 What typifies the first and second waves of HRM?

Answered: 1 week ago