比赛 20101116 评测结果 AAAAAAAAAA
题目名称 打砖块 最终得分 100
用户昵称 mate 运行时间 0.000 s
代码语言 Pascal 内存使用 0.00 MiB
提交时间 2010-11-16 11:26:37
显示代码纯文本
program ss;
var
f,a,b,e,r:array[0..201,0..201] of longint;
c:array[0..201,0..201] of char;
i,j,t,n,m,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.