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