High-effort vs. Low-effort Task Problem
A list of n days is given to you and there are three columns. One is the day, the second one is high-effort value, and the another one is low-effort value. At a time you can pick only one either high-effort value or low-effort value. You can pick a high-effort task only when you don't take any of the tasks at the day before. You have to find out the maximum task is possible in n days.
Input:
T Test case
T no. of input string will be given to you.
E.g.
2
Day High Low
1 4 3
2 5 6
3 9 4
4 12 5
5 5 4
Day High Low
1 2 3
2 4 2
3 7 8
4 9 7
5 10 6
Constrain:
1≤ n ≤50
Output:
Print the maximum task is possible in n days.
Example
T=2
Input:
5
4 5 9 12 5
3 6 4 5 4
Output:
26 ( 4+ 6+ 12+ 4)
Input:
5
2 4 7 9 10
3 2 8 7 6
Output:
26 (3+2+8+7+6)
To solve this task problem using dynamic programming approach, we consider these two conditions,
After getting the value we will choose the maximum value between them.
Example:
C++ Implementation:
Output
need an explanation for this answer? contact us directly to get an explanation for this answer