记录编号 168728 评测结果 AAAAAAAAAA
题目名称 机器分配 最终得分 100
用户昵称 Gravatar啊吧啦吧啦吧 是否通过 通过
代码语言 C++ 运行时间 0.016 s
提交时间 2015-07-06 16:10:45 内存使用 0.33 MiB
显示代码纯文本
#include<cstdio>
#include<algorithm>

using namespace std;

const int MAXN = 101, MAXM = 101;
int n, m, a[MAXM][MAXN] = {0}, dp[MAXM][MAXN] = {0};
inline int qread();

main()
{
	freopen("machinea.in", "r", stdin);
	freopen("machinea.out", "w", stdout);
	n = qread();
	m = qread();
	for(int i = 1; i <= m; i ++)
		for(int j = 1; j <= n; j ++)
			a[i][j] = qread();
	
	for(int i = 1; i <= m; i ++)
		for(int j = 1; j <= n; j ++)
			for(int k = 0; k <= j; k ++)
				dp[i][j] = max(dp[i][j], dp[i - 1][j - k] + a[i][k]);
				
	printf("%d", dp[m][n]);
//	scanf("%d", &m); 
	fclose(stdin);
	fclose(stdout);
}

inline int qread()
{
    int x = 0;
    char ch;
    do
        ch = getchar();
    while(ch < '0' || ch > '9');
    while(ch >= '0' && ch <= '9')
    {
        x *= 10;
        x += ch - '0';
        ch = getchar();
    }
    return x;
}