经典题目不多说
1 var f:array[0..1010,0..1010] of longint; 2 l,r:array[0..1010] of longint; 3 i,j,n,m,ans:longint; 4 x:char; 5 6 function max(a,b:longint):longint; 7 begin 8 if a>b then exit(a) else exit(b); 9 end;10 11 begin12 readln(n,m);13 for i:=1 to n do14 begin15 for j:=1 to m do16 begin17 read(x);18 if x=' ' then read(x);19 if x='F' then20 f[i,j]:=f[i-1,j]+121 else f[i,j]:=0;22 end;23 readln;24 end;25 26 for i:=1 to n do27 begin28 l[1]:=1;29 for j:=1 to m do30 begin31 l[j]:=j;32 while (l[j]-1>0) and (f[i,j]<=f[i,l[j]-1]) do l[j]:=l[l[j]-1];33 end;34 r[m]:=m;35 for j:=m-1 downto 1 do36 begin37 r[j]:=j;38 while (r[j]+1<=m) and (f[i,j]<=f[i,r[j]+1]) do r[j]:=r[r[j]+1];39 end;40 for j:=1 to m do41 ans:=max(ans,f[i,j]*(r[j]-l[j]+1));42 end;43 writeln(3*ans);44 end.