达达 2012-07-11 05:50:00
点我顶贴
收藏
删除
var q,w,e,r,i,j,k,l,o,max:longint;
function min(x,y:longint):longint;
begin
if x>y then min:=y else min:=x;
end;
begin
readln(q,w,e,r);
for i:=0 to q div 5 do
for j:=0 to min(q div 3,w) do
for k:=0 to min(q div 2,e) do
for l:=0 to min(w,e) do
for o:=0 to min(q,r) do
begin
if 5*i+3*j+2*k+o>q then continue;
if j+l>w then continue;
if k+l>e then continue;
if o>r then continue;
if i+j+k+l+o>max then max:=i+j+k+l+o;
end;
writeln(max);
end.
数据太强了