#hdu1712. ACboy需要你的帮助
ACboy需要你的帮助
Problem Description
ACboy has courses this term, and he plans to spend at most days on study.Of course,the profit he will gain from different course depending on the days he spend on it.How to arrange the days for the courses to maximize the profit?
Input
The input consists of multiple data sets. A data set starts with a line containing two positive integers and , is the number of courses, is the days ACboy has.
Next follow a matrix , (). indicates if ACboy spend days on ith course he will get profit of value .
and ends the input.
Output
For each data set, your program should output a line which contains the number of the max profit ACboy will gain.
2 2
1 2
1 3
2 2
2 1
2 1
2 3
3 2 1
3 2 1
0 0
3
4
6