PLEASE WRITE COMMENTS AND PSEUDO CODE WITH THE CODE!! Interval Coverage Problem 1: Introduction Problem description and

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

PLEASE WRITE COMMENTS AND PSEUDO CODE WITH THE CODE!! Interval Coverage Problem 1: Introduction Problem description and

Post by answerhappygod »

PLEASE WRITE COMMENTS AND PSEUDO CODE WITH THE
CODE!!
Interval Coverage Problem
1: Introduction
Problem description and (if any) e of the
algorithms.
Description:
Use i to represent the interval with coordinate (i-1, i) and
length 1 on the X coordinate axis, and give n (1n200) as different
integers to represent n such intervals. Now it is required to draw
m line segments to cover all sections, provided that each line
segment can be arbitrarily long, but the sum of the line lengths is
required to be the smallest, and the number of line segments does
not exceed m (1m50).
Input: the input includes multiple groups
of data. The first row of each group of data represents the number
of intervals n and the number of required line segments m, and the
second row represents the coordinates of n points.
Output: each group of output occupies one
line, and the minimum length sum of m line segments are output.
Sample Input:
5 3
1 3 8 5 11
Sample Output
7
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply