比赛 20101116 评测结果 AAAAAAWWWA
题目名称 打砖块 最终得分 70
用户昵称 reamb 运行时间 0.000 s
代码语言 Pascal 内存使用 0.00 MiB
提交时间 2010-11-16 10:26:56
显示代码纯文本
program zhuan;
var
  a:array[1..200,1..200]of longint;
  sum,s:array[0..200,0..200]of longint;
  c:array[0..201,0..201]of char;
  n,m,i,j,max,k,z:longint;
  f:array[0..200,0..200]of longint;
begin
  assign (input,'gamea.in');
  reset (input);
  assign (output,'gamea.out');
  rewrite (output);
    readln (n,m,z);
    for i:=1 to n do
    begin
      for j:=1 to m do
      begin
        read (a[i,j]);
        read (c[i,j]);
        read (c[i,j])
      end;
      readln
    end;
    for i:=1 to m do
      for j:=1 to n do
        sum[i,j]:=sum[i,j-1]+a[n-j+1,i];
    for i:=1 to m do
      for j:=1 to n do
        if c[n-j+1,i]='Y' then
          s[i,j]:=s[i,j-1]+1
        else
          s[i,j]:=s[i,j-1];
    for i:=1 to m do
      for k:=0 to z do
        for j:=0 to n do
          if c[n-j+1,i]='Y' then
          begin
            if k>j-s[i,j] then
              if f[i-1,k-j+s[i,j]]+sum[i,j]>f[i,k]  then
                f[i,k]:=f[i-1,k-j+s[i,j]]+sum[i,j]
          end
          else
          begin
            if k>=j-s[i,j] then
              if f[i-1,k-j+s[i,j]]+sum[i,j]>f[i,k]  then
                f[i,k]:=f[i-1,k-j+s[i,j]]+sum[i,j]
          end;
    max:=0;
    for i:=1 to m do
      if f[i,z]>max then
        max:=f[i,z];
    writeln (max);
  close (input);
  close (output)
end.