{"trustable":false,"prependHtml":"\u003cscript\u003e window.katexOptions \u003d { disable: true }; \u003c/script\u003e\n\u003cscript type\u003d\"text/x-mathjax-config\"\u003e\n MathJax.Hub.Config({\n tex2jax: {\n inlineMath: [[\u0027$$$\u0027,\u0027$$$\u0027], [\u0027$\u0027,\u0027$\u0027]],\n displayMath: [[\u0027$$$$$$\u0027,\u0027$$$$$$\u0027], [\u0027$$\u0027,\u0027$$\u0027]]\n }\n });\n\u003c/script\u003e\n\u003cscript async src\u003d\"https://mathjax.codeforces.org/MathJax.js?config\u003dTeX-AMS-MML_HTMLorMML\" type\u003d\"text/javascript\"\u003e\u003c/script\u003e","sections":[{"title":"","value":{"format":"HTML","content":"\u003cdiv\u003e \n \u003cspan\u003eACboy\u003c/span\u003e has N courses this term, and he plans to spend at most M 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 M days for the N courses to maximize the profit?\n\u003c/div\u003e \n\u003cdiv\u003e\n ACboy这个学期有N门课,他打算在学习上花最多M天。当然,不同课程的收益取决于他在它上花费的时间。怎样为N门课程安排M天让总收益最大化?\n\u003c/div\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cp\u003e The input consists of multiple data sets. A data set starts with a line containing two positive integers N and M, N is the number of courses, M is the days \u003cspan\u003eACboy\u003c/span\u003e has.\u003cbr\u003e Next follow a matrix A[i][j], (1\u0026lt;\u003di\u0026lt;\u003dN\u0026lt;\u003d100,1\u0026lt;\u003dj\u0026lt;\u003dM\u0026lt;\u003d100).A[i][j] indicates if \u003cspan\u003eACboy\u003c/span\u003e spend j days on \u003cspan\u003eith\u003c/span\u003e course he will get profit of value A[i][j].\u003cbr\u003e N \u003d 0 and M \u003d 0 ends the input.\u003cbr\u003e \u0026nbsp;\u003c/p\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cp\u003e For each data set, your program should output a line which contains the number of the max profit \u003cspan\u003eACboy\u003c/span\u003e will gain.\u003cbr\u003e \u0026nbsp;\u003c/p\u003e"}},{"title":"Sample Input","value":{"format":"HTML","content":"\u003cpre\u003e\r\n2 2\r\n1 2\r\n1 3\r\n2 2\r\n2 1\r\n2 1\r\n2 3\r\n3 2 1\r\n3 2 1\r\n0 0\u003c/pre\u003e"}},{"title":"Sample Output","value":{"format":"HTML","content":"\u003cpre\u003e\r\n3\r\n4\r\n6\u003c/pre\u003e"}}]}