记录编号 |
22080 |
评测结果 |
AAAAAAAAAA |
题目名称 |
打砖块 |
最终得分 |
100 |
用户昵称 |
maxiem |
是否通过 |
通过 |
代码语言 |
Pascal |
运行时间 |
1.030 s |
提交时间 |
2010-11-16 20:48:42 |
内存使用 |
0.93 MiB |
显示代码纯文本
program gamea;
var
tmp,k,t,n,m,i,j,a:longint;
table,rown,rowy,sumy,sumn:array [0..201,0..201] of longint;
flag:array [0..201,0..201] of boolean;
temp,temp2:char;
begin
fillchar (rown,sizeof(rown),0);
fillchar (rowy,sizeof(rowy),0);
fillchar (sumn,sizeof(sumn),0);
fillchar (sumy,sizeof(sumy),0);
fillchar (table,sizeof(table),0);
fillchar (flag,sizeof(flag),0);
assign (input,'gamea.in');
reset (input);
readln (n,m,k);
for i:=1 to n do begin
for j:=1 to m do begin
read (table[i,j],temp,temp2);
if temp2='Y' then flag[i,j]:=true;
end;
readln;
end;
close (input);
assign (output,'gamea.out');
rewrite (output);
for i:=1 to m do begin
t:=n;
while (t>0) and (flag[t,i]) do begin
rown[i,0]:=rown[i,0]+table[t,i];
dec(t);
end;
for j:=1 to n do if t>0 then begin
rowy[i,j]:=rown[i,j-1]+table[t,i];
rown[i,j]:=rowy[i,j];
dec(t);
while (t>0) and (flag[t,i]) do begin
rown[i,j]:=rown[i,j]+table[t,i];
dec(t);
end;
end;
end;
for j:=1 to m do begin
for i:=0 to k do begin
for a:=0 to n do begin
if a<=i then begin
tmp:=sumn[j-1,i-a]+rown[j,a];
if tmp>sumn[j,i] then sumn[j,i]:=tmp;
if a<i then begin
tmp:=sumy[j-1,i-a]+rown[j,a];
if tmp>sumy[j,i] then sumy[j,i]:=tmp;
end;
if a>0 then begin
tmp:=sumn[j-1,i-a]+rowy[j,a];
if tmp>sumy[j,i] then sumy[j,i]:=tmp;
end;
end;
end;
end;
end;
writeln (sumy[m,k]);
close (output);
end.