比赛 |
10101115 |
评测结果 |
AWAWEEEEEE |
题目名称 |
技能树 |
最终得分 |
20 |
用户昵称 |
reamb |
运行时间 |
0.000 s |
代码语言 |
Pascal |
内存使用 |
0.00 MiB |
提交时间 |
2010-11-15 09:31:21 |
显示代码纯文本
- program jinengshu;
- var
- f:array[0..10,0..10,0..11,0..100] of longint;
- sum,a:array[1..10,0..10]of longint;
- i,j,k,l,p,q,max,s,d,n,m:longint;
- begin
- assign (input,'skill.in');
- reset (input);
- assign (output,'skill.out');
- rewrite (output);
- readln (n,m);
- for i:=1 to n do
- begin
- for j:=1 to n-i+1 do
- begin
- read (a[i,j]);
- sum[i,j]:=sum[i,j-1]+a[i,j]
- end;
- readln
- end;
- for i:=1 to n do
- for j:=1 to n-i+1 do
- for k:=j to n-i+1 do
- for l:=1 to m do
- begin
- d:=k-j+1;
- if l>=d then
- begin
- max:=0;
- s:=sum[i,k]-sum[i,j-1];
- for p:=j downto 1 do
- for q:=k+1 to n-i+2 do
- if f[i-1,p,q,l-d]+s>max then
- max:=f[i-1,p,q,l-d]+s;
- f[i,j,k,l]:=max
- end
- end;
- max:=0;
- for i:=1 to n do
- for j:=1 to n-i+1 do
- for k:=i to n-i+1 do
- if f[i,j,k,m]>max then
- max:=f[i,j,k,m];
- writeln (max);
- close (input);
- close (output)
- end.