RQ157 晚餐队列安排
RQ83 魔兽世界

RQ140 分配时间

Uxuard posted @ 2011年8月16日 00:21 in 水题 with tags OI RQNOJ 水题 , 1125 阅读

分组背包

 

var
	u:array[1..11,0..101] of longint;
        f:array[0..100000] of longint;
        i,j,x,t,n,nam:longint;

function max(a,b:longint):longint;
begin
	if a>b then exit(a)
	else exit(b);
end;

begin
        readln(t,n,nam);
	for i:=1 to n do
	begin
		for j:=1 to t do
		read(u[i][j]);
	end;
	for i:=1 to n do
	for x:=t downto 0 do
	for j:=1 to t do
        if x-j-nam>=0 then
        f[x]:=max(f[x],f[x-j-nam]+u[i][j]);
	write(f[t]);
end.

登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter