比赛 |
20101116 |
评测结果 |
ATTTTTTTTW |
题目名称 |
打砖块 |
最终得分 |
10 |
用户昵称 |
Des. |
运行时间 |
0.000 s |
代码语言 |
Pascal |
内存使用 |
0.00 MiB |
提交时间 |
2010-11-16 11:05:54 |
显示代码纯文本
program gamea;
var f:array[0..200,0..200,0..200]of longint;
a:array[1..200,1..200]of longint;
c:array[1..200,1..200]of char;
t,k,m,n,i,j,p,max,k1:longint;
ch:char;
begin
assign(input,'gamea.in');
reset(input);
assign(output,'gamea.out');
rewrite(output);
readln(n,m,k1);
for i:=n downto 1 do
begin
for j:=1 to m do
read(a[i,j],ch,c[i,j]);
readln;
end;
for i:=0 to n do
for t:=0 to m do
for k:=1 to k1+1 do
f[t,i,k]:=-maxint;
if c[1,1]='Y' then f[1,1,k1]:=a[1,1] else f[1,1,k1-1]:=a[1,1];
{f[0,1,k1]:=0;}
if k1=1 then max:=a[1,1];
for i:=1 to m do
for j:=1 to n do
if (i<>1)or(j<>1) then
for k:=0 to k1 do
begin
if j=1 then
if (c[j,i]='Y') then
begin
for t:=0 to i-1 do
for p:=1 to n do
if (f[i,j,k]<f[t,p,k]) then
f[i,j,k]:=f[t,p,k];
f[i,j,k]:=f[i,j,k]+a[j,i];
end
else if c[j,i]='N' then
begin
for t:=0 to i-1 do
for p:=1 to n do
if f[i,j,k]<f[t,p,k+1] then
f[i,j,k]:=f[t,p,k+1];
f[i,j,k]:=f[i,j,k]+a[j,i];
end;
if j>1 then
if (c[j,i]='Y') then
f[i,j,k]:=f[i,j-1,k]+a[j,i]
else f[i,j,k]:=f[i,j-1,k+1]+a[j,i];
if (k=0)and(f[i,j,k]>max) then max:=f[i,j,k];
end;
writeln(max);
close(output);
end.