记录编号 22074 评测结果 AAAAAAAAAA
题目名称 打砖块 最终得分 100
用户昵称 Gravatarnick09 是否通过 通过
代码语言 Pascal 运行时间 0.983 s
提交时间 2010-11-16 20:33:40 内存使用 0.93 MiB
显示代码纯文本
var  f,a,b,e,r:array[0..201,0..201]of longint;
c:array[0..201,0..201]of char;
i,j,t,m,n,k,q:longint;
s:char;
begin
assign(input,'gamea.in');reset(input);
assign(output,'gamea.out');rewrite(output);
readln(n,m,k);
for i:=1 to n do
 begin
 for j:=1 to m do
   read(f[i,j],s,c[i,j]);
 end;
for i:=1 to m do
begin
 t:=n;
 while (t>0)and(c[t,i]='Y')do
   begin
   inc(e[i,0],f[t,i]);dec(t);
   end;
 for j:=1 to n do
  if t>0 then
   begin
   r[i,j]:=e[i,j-1]+f[t,i];
   e[i,j]:=r[i,j];
   dec(t);
   while (t>0)and(c[t,i]='Y')do
     begin
     inc(e[i,j],f[t,i]);
     dec(t);
     end;
   end;
  end;
for i:=1 to m do
for j:=0 to k do
 for t:=0 to n do
  if t<=j then
 begin
 q:=a[i-1,j-t]+e[i,t];
 if q>a[i,j] then a[i,j]:=q;
 if t<j then
  begin
  q:=b[i-1,j-t]+e[i,t];
  if q>b[i,j] then b[i,j]:=q;
  end;
  if t>0 then
   begin
   q:=a[i-1,j-t]+r[i,t];
   if q>b[i,j] then b[i,j]:=q;
   end;
  end;
 writeln(b[m,k]);



close(input);close(output);

end.