Professional Documents
Culture Documents
Arjuna Session-33 29th Sep 2019 Problems PDF
Arjuna Session-33 29th Sep 2019 Problems PDF
Season-4
KMIT-APA-4008 Programming Assignments Sunday 29th Sept, 2019
Now, Yudhisthir is cautious this time and just wants to win the game. So, he requested you to write a
program to find the length of the minimum sequence of Lions or Deers to reach the given target
number.
Input/Output
Input Output Comments
5 7 ● 5 is the target given.
● The shortest sequence of L’s and D’s to reach 5 could "LLLDLDL".
● For the above sequence,
o DiamondPoints(DP) goes from 0->1->3->7->7->6->6->5.
o LuckFactor(LF) goes to 1-> 2-> 4-> -1-> 1-> -1-> 1.
Note:
Though DiamondPoints 7 and 6 are more than 5, the game does
not stop because the target is to reach exactly 5.
4 2 ● 4 is the target given
● The shortest sequence of L’s and
Imagine, there are N transport vehicles parked in a horizontal line and in each of them, the
workers, without bothering about the load, have dumped random number of concrete block(s).
There is one small crane that can shift only one (1) concrete block at a time from one vehicle to
its adjacent vehicle. It makes several r ounds of shifting. In one round it can move only one block
to its appropriate vehicle among several vehicles.
Given the number of blocks in each of those N vehicles, the transport manager wants to find
the minimum number of rounds (not moves) the small crane must make so that all vehicles
have an equal number of blocks in all vehicles. Write a program to help him.
Input/Output
Input Output Comments
204 2 ● 2 0 4 corresponds to three vehicles and number of blocks in each of
them.
● Here are the possible movements from
o Round-1: 2 0 <-- 4 => 2 1 3
o Round-2: 2 1 <-- 3 => 2 2 2
9 14 1 7 ● Here are the possible movements
o Round-1: 9 -->14 --> 1 => 8 14 2
o Round-2: 8 14 --> 2 => 8 13 3
o Round-3: 8 13 --> 3 => 8 12 4
o Round-4: 8 12 --> 4 => 8 11 5
o Round-5: 8 11 --> 5 => 8 10 6
o Round-6: 8 10 --> 6 => 8 9 7
o Round-7: 8 9 --> 7 => 8 8 8
1351 -1 ● It is impossible to have equal number of blocks in all vehicles.
Based on the requirements of the projects, the Project Manager estimates the number of
developers required every project. Every project P[i] shall have some estimated number of
developers D[i].
Now the project manager wants to know the combinations of developer teams that can work
on different projects and reach the minimum-earning-target.
Given the total number of developers (N), minimum-earning-target (MET), the estimated
number of developers and worth of projects identified, write a program to find the total
number of combinations of possible executions of projects using the estimated number of
developers to make MET. Return 0 if it is not possible to make MET with any of the
combinations.
Input/Output
Input Output Comments
6 6 ● The first line 6 represents the total number of developers (N)
40 ● Second line 40 represents minimum-earning-target (MET)
123 ● Third line 1 2 3 represents the estimated number of developers.
30 40 50 ● Fourth line 30 40 50 represents the worth of the projects.
● The estimated number of developers and projects combinations to
earn minimum 40 are: (2->40), (3->50), (2->40, 3->50), (1->30,
3->50), (1->30, 2->40), (1->30, 2->40, 3->50)
6 0 ● None of the combinations of teams and projects can earn a minimum of 15
15
231
234
5 0 ● N=5. MET=5.
5 ● As per estimation, J[0] and J[1] needs 4 and 6 developers. Two projects
46 must be finished to earn MET but the total developers needed are 10
23 (more than 5). Hence, it is not possible to reach MET
10 42
8
1 2 3 2 1 1
1 2 4 4 6 2