比赛 20101116 评测结果 TTTTTTTTTA
题目名称 打砖块 最终得分 10
用户昵称 itachi 运行时间 0.000 s
代码语言 Pascal 内存使用 0.00 MiB
提交时间 2010-11-16 10:57:44
显示代码纯文本
program t2(input,output);
const
jl:array['N'..'Y'] of byte =(0,0,0,0,0,0,0,0,0,0,0,1);
type
atype=array[1..200] of integer;
var
n,m,k,i:longint; ans:int64;
data:array[1..200,1..200] of longint;
map:array[1..200,1..200]of integer;
 q:atype;

 procedure init;
 var
 i,j:longint;ch:char;
 begin
 fillchar(data,sizeof(data),0);
 fillchar(map,sizeof(map),0);
 readln(n,m,k);
   for i:= 1 to n do
   for j:=1 to m  do
   begin
    read(data[i,j]);
    read(ch);
    read(ch);
    map[i,j]:=jl[ch];
   end;
 end;
 procedure dfs(h:atype;s:longint;temp:int64);
  var
  i:longint;
  begin
    if s=0  then begin if temp>ans then ans:=temp; exit;  end;
    dec(s);
    for i:= 1 to m do
      begin
      if h[i]<=0 then continue ;
      inc(temp,data[h[i],i]);
      inc(s,map[h[i],i]);
      dec(h[i]);
      dfs(h,s,temp);
       if temp>ans then ans:=temp;
       inc(h[i]);
      dec(s,map[h[i],i]);
      dec(temp,data[h[i],i]);


      end;
  end;
 begin
assign(input,'gamea.in');
reset(input);
assign(output,'gamea.out');
rewrite(output);
 init;
 close(input);
 ans:=0;
 for i:= 1 to m do
 q[i]:=n;
 dfs(q,k,0);
 writeln(ans);
 close(output);
end.