|
|
вернуться в форум1208 Послано ACer 29 янв 2003 16:58 why my program got TL!!!!!!!!!!!!!!! type arr=array[1..54]of string; var team1:arr; a:array[1..18,1..3]of string; x:longint; s:string; max_t,max,i,j,n,h:longint; procedure team(num:longint); var i,j,l:longint; function p:boolean; var i,j:longint; begin p:=true; for i:=1 to x*3 do if (a[num,1]=team1[i])or(a[num,2]=team1[i])or(a[num,3]=team1 [i]) then begin p:=false;exit;end; end; begin if num>n then exit; for i:=num to n do if p then begin team1[x*3+1]:=a[num,1]; team1[x*3+2]:=a[num,2]; team1[x*3+3]:=a[num,3]; inc(max_t);inc(x); for j:=i+1 to n do team(j); if max_t>max then max:=max_t; dec(max_t);dec(x); team1[x*3+1]:=''; team1[x*3+2]:=''; team1[x*3+3]:=''; end; end; begin readln(n); for i:=1 to n do begin readln(s);h:=1; for j:=1 to length(s) do if s[j]<>' ' then a[i,h]:=a[i,h]+s[j] else inc(h); end; s:=''; max:=0;x:=0;max_t:=0; team(1); writeln(max); end. |
|
|