W.C 3.2 Wire Pieces

A wire of length n has to be cut in a way that it fulfils the following two criteria -

a. After cutting each wire piece should have length x, y or z

b. After cutting, the number of wire pieces should be maximum.

Note : if the wire cannot fulfil criteria a return -1

Find the number of wire pieces after the required cutting.

Test cases :

Case 1:
n=10,x=5,y=2,z=3
Expected result = 5 (10=2+2+2+2+2).

Case 2:
n=16,x=7,y=5,z=3

Case 3:
n=10000,x=19,y=35,z=37

Case 4:
n=2501,x=8,y=4,z=6

Case 5:
n=10520,x=217,y=88,z=129

Case 6:
n=300001,x=263,y=311,z=179

Final answer should be : sum of all 6 test cases.

This challenge is worth 80 points.

You must be logged in to submit a solution

View ranklist for this challenge
About scoring and submission

Contact Us


Kunal Desai : 7715051136

Neelraj Patil : 9930671144



Privacy Policy