记录编号 |
21970 |
评测结果 |
AAAAAAAAAA |
题目名称 |
打砖块 |
最终得分 |
100 |
用户昵称 |
王者自由 |
是否通过 |
通过 |
代码语言 |
Pascal |
运行时间 |
0.936 s |
提交时间 |
2010-11-16 12:58:43 |
内存使用 |
0.93 MiB |
显示代码纯文本
program gamea;
var i,j,t,n,m,k,q:longint;
num,qn{i j N},qy{i j Y},dn{No.i j N},dy{No.i j Y}:array[0..201,0..201]of longint;
yn:array[0..201,0..201] of char;
c: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(num[i,j],c,yn[i,j]);
readln;
end;
for i:=1 to m do
begin
t:=n;
while (t>0)and(yn[t,i]='Y')do
begin
dn[i,0]+=num[t,i];
t:=t-1;
end;
for j:=1 to n do
if t>0 then begin
dy[i,j]:=dn[i,j-1]+num[t,i];
dn[i,j]:=dy[i,j];
t:=t-1;
while (t>0)and(yn[t,i]='Y') do
begin
dn[i,j]+=num[t,i];
t:=t-1;
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:=qn[i-1,j-t]+dn[i,t];
if q>qn[i,j] then
qn[i,j]:=q;
if t<j then begin
q:=qy[i-1,j-t]+dn[i,t];
if q>qy[i,j] then qy[i,j]:=q;
end;
if t>0 then begin
q:=qn[i-1,j-t]+dy[i,t];
if q>qy[i,j] then qy[i,j]:=q;
end;
end;
writeln(qy[m,k]);
close(input); close(output);
end.