比赛 |
20101116 |
评测结果 |
ATTTTTTTTA |
题目名称 |
打砖块 |
最终得分 |
20 |
用户昵称 |
magic |
运行时间 |
0.000 s |
代码语言 |
Pascal |
内存使用 |
0.00 MiB |
提交时间 |
2010-11-16 10:45:41 |
显示代码纯文本
program gls;
var
a,n,m,i,j,ans,max:longint;c,ch:char;
k:int64;
data:array[1..200,1..200]of longint;
dat:array[1..200,1..200]of char;
tail:array[1..200]of longint;
f,g:text;
procedure make; {zidan meide qing kuang meixie }
var y,j:longint;
function pd:boolean;
var yy,remain:longint;flag:boolean;
begin flag:=true;
for yy:=1 to m do
if tail[yy]<>0 then flag:=false;
pd:=flag;
end;
begin
if (k=0)or(pd=true) then
begin if max>ans then ans:=max;end;
if (k>0)and(pd=false) then
begin for y:=1 to m do
begin
if tail[y]>0 then begin
if dat[tail[y],y]='Y' then begin
max:=max+data[tail[y],y];
dec(tail[y]);
make;
inc(tail[y]);
max:=max-data[tail[y],y]; end;
if dat[tail[y],y]='N' then begin
max:=max+data[tail[y],y];
dec(tail[y]);
dec(k);
make;
inc(tail[y]);
inc(k);
max:=max-data[tail[y],y];
end;
end;
end;
end;
end;
begin
assign(f,'gamea.in');
reset(f);
assign(g,'gamea.out');
rewrite(g);
readln(f,n,m,k);
for i:=1 to n do
begin for j:=1 to m do
begin read(f,a,ch,c);
data[i,j]:=a;
dat[i,j]:=c;
{write(g,dat[i,j],' ');}
end;
end;
for i:=1 to m do begin tail[i]:=n;{write(g,tail[i]);}end;
make;
writeln(g,ans);
close(f);close(g);
end.