You are given N programming problems that must be solved in N days in any order. The two programming languages are allowed, Java and C. The time(hour) for solving the problems using C and Java is also given. The only constraint is that you cannot use same programming languages on two consecutive days. Determine the minimum hours is needed to solve all the N problems. Input format: First line: Number of problems/days (N) 2nd line: Time for solving each problem using C 3rd line: Time for solving each problem using JAVA Output format: Minimum hours needed to solve all N problems in N days Example: Input: 5 3 2 5 7 19 10 1 4 2 21 Output: 29 Explanation 1st day: 2nd problem: Java= 1 2nd day: 1st problem: C= 3 3rd day: 3rd problem: Java= 4 4th day: 5th problem: C= 19 5th day: 4th problem: Java= 2 Total: 1+3+4+19+2=29
You are given N
Input format:
First line: Number of problems/days (N)
2nd line: Time for solving each problem using C
3rd line: Time for solving each problem using JAVA
Output format:
Minimum hours needed to solve all N problems in N days
Example:
Input:
5
3 2 5 7 19
10 1 4 2 21
Output:
29
Explanation
1st day: 2nd problem: Java= 1
2nd day: 1st problem: C= 3
3rd day: 3rd problem: Java= 4
4th day: 5th problem: C= 19
5th day: 4th problem: Java= 2
Total: 1+3+4+19+2=29
Step by step
Solved in 3 steps with 1 images