比赛 |
20101116 |
评测结果 |
AAAAWWWWWA |
题目名称 |
打砖块 |
最终得分 |
50 |
用户昵称 |
1102 |
运行时间 |
0.000 s |
代码语言 |
Pascal |
内存使用 |
0.00 MiB |
提交时间 |
2010-11-16 09:36:02 |
显示代码纯文本
program xxxx;
var n,m,k,j,i,j1:longint;
c:char;
a:array[1..200,1..200] of longint;
f:array[0..200,0..200] of longint;
chr:array[1..200,1..200] of char;
b:array[0..200,0..200,1..2] of longint;
function max(a1,a2,a3:longint):longint;
var x:longint;
begin
x:=0;
if a1>x then
x:=a1;
if a2>x then
x:=a2;
if a3>x then
x:=a3;
max:=x;
end;
begin
assign(input,'gamea.in');
reset(input);
assign(output,'gamea.out');
rewrite(output);
read(n,m,k);
for i:=1 to n do
for j:=1 to m do
read(a[i,j],c,chr[i,j]);
for i:=1 to m do
begin
for j:=n downto 1 do
begin
b[i,0,1]:=0;
b[i,0,2]:=0;
b[i,n-j+1,1]:=b[i,n-j,1]+a[j,i];
if chr[j,i]='N' then
b[i,n-j+1,2]:=b[i,n-j,2]+1
else
b[i,n-j+1,2]:=b[i,n-j,2];
end;
end;
for i:=1 to k do
for j:=1 to m do
for j1:=1 to n do
if i-b[j,j1,2]>=0 then
f[i,j]:=max(f[i,j-1],f[i-b[j,j1,2],j-1]+b[j,j1,1],f[i,j]);
write(f[k,m]);
close(input);
close(output);
end.