Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program Hello;
- Uses sysutils,crt;
- var
- tymy: array[1..4] of string;
- pole: array[1..5, 1..8] of string;
- i,j:integer;
- x,y:string;
- a,b,c,p:string;
- a1,b1,c1,a2,b2,c2,x1,y1:integer;
- s1,s2,s3:integer;
- h: array [1..4] of integer; {poradi}
- r,mp:integer; {poradi}
- p1: array [1..4] of boolean; {poradi}
- p2: array [1..4] of boolean; {poradi}
- begin
- p:=('-');s1:=0;s2:=0;s3:=0;
- tymy[1]:='OLM' ;
- tymy[2]:='OST' ;
- tymy[3]:='HRA';
- tymy[4]:='HOL' ;
- //clrscr();
- writeln(' Výpis týmů ');
- writeln('>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>');
- writeln('1.TÝM:', tymy[1],', 2.TÝM: ',tymy[2],', 3.TÝM: ',tymy[3],', 4.TÝM: ',tymy[4]);
- writeln('<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<');
- for i:=1 to 4 do // Vkladani tymu do TAB - R
- begin
- pole[1,i+1]:=tymy[i];
- end;
- for i:=1 to 4 do // Vkladani tymu do TAB - SL
- begin
- pole[i+1,1]:=tymy[i];
- end;
- for i:=1 to 5 do //Eliminace zápasů shodných družstev
- begin
- pole[i,i]:=('-----');
- end;
- for i:=1 to 5 do
- begin
- pole[i,6]:=('||');
- end;
- writeln('stiskni ENTER pro pokracovani');
- readln();
- clrscr();
- for i:=1 to 5 do
- begin
- for j:=1 to 8 do
- begin
- write(' ',pole[i,j],' ');
- end;
- writeln;
- end;
- //Vložení výsledků do tabulky
- writeln('ZADEJ VÝSLEDKY do tabulky ve tvaru X-Y');
- writeln('Výsledek zapasu ',tymy[1],' : ',tymy[2]); // 1.zapas
- readln(pole[2,3]);
- x:=pole[2,3];
- a:=x[1];b:=x[2];c:=x[3];
- y:=(c+b+a);
- pole[3,2]:=y;
- writeln('stiskni ENTER pro pokracovani');
- readln();
- clrscr();
- for i:=1 to 5 do
- begin
- for j:=1 to 8 do
- begin
- write(' ',pole[i,j],' ');
- end;
- writeln;
- end;
- writeln('Výsledek zapasu ',tymy[1],' : ',tymy[3]); // 2.zapas
- readln(pole[2,4]);
- x:=pole[2,4];
- a:=x[1];b:=x[2];c:=x[3];
- y:=(c+b+a);
- pole[4,2]:=y;
- writeln('stiskni ENTER pro pokracovani');
- readln();
- clrscr();
- for i:=1 to 5 do
- begin
- for j:=1 to 8 do
- begin
- write(' ',pole[i,j],' ');
- end;
- writeln;
- end;
- writeln('Výsledek zapasu ',tymy[1],' : ',tymy[4]); //3. zapas
- readln(pole[2,5]);
- x:=pole[2,5];
- a:=x[1];b:=x[2];c:=x[3];
- y:=(c+b+a);
- pole[5,2]:=y;
- writeln('stiskni ENTER pro pokracovani');
- readln();
- clrscr();
- for i:=1 to 5 do
- begin
- for j:=1 to 8 do
- begin
- write(' ',pole[i,j],' ');
- end;
- writeln;
- end;
- writeln('Výsledek zapasu ',tymy[2],' : ',tymy[3]); //4. zapas
- readln(pole[3,4]);
- x:=pole[3,4];
- a:=x[1];b:=x[2];c:=x[3];
- y:=(c+b+a);
- pole[4,3]:=y;
- writeln('stiskni ENTER pro pokracovani');
- readln();
- clrscr();
- for i:=1 to 5 do
- begin
- for j:=1 to 8 do
- begin
- write(' ',pole[i,j],' ');
- end;
- writeln;
- end;
- writeln('Výsledek zapasu ',tymy[2],' : ',tymy[4]); //5. zapas
- readln(pole[3,5]);
- x:=pole[3,5];
- a:=x[1];b:=x[2];c:=x[3];
- y:=(c+b+a);
- pole[5,3]:=y;
- writeln('stiskni ENTER pro pokracovani');
- readln();
- clrscr();
- for i:=1 to 5 do
- begin
- for j:=1 to 8 do
- begin
- write(' ',pole[i,j],' ');
- end;
- writeln;
- end;
- writeln('Výsledek zapasu ',tymy[3],' : ',tymy[4]); //6. zapas
- readln(pole[4,5]);
- x:=pole[4,5];
- a:=x[1];b:=x[2];c:=x[3];
- y:=(c+b+a);
- pole[5,4]:=y;
- writeln('stiskni ENTER pro pokracovani');
- readln();
- clrscr();
- for i:=1 to 5 do
- begin
- for j:=1 to 8 do
- begin
- write(' ',pole[i,j],' ');
- end;
- writeln;
- end;
- clrscr;
- writeln('Výsledná tabulka zápasů');
- writeln('---------------------------------------------------------------');
- pole[1,7]:=('SCORE');pole[1,8]:=('BODY');
- a:=(pole[2,3][1]);b:=(pole[2,4][1]);c:=(pole[2,5][1]); //1 tym; přistup pomocí indexů pole[2,3][1] na řádku 2,3 sloupec 1 znak obsahu
- a1:=StrToInt(a);b1:=StrToInt(b);c1:=StrToInt(c);x1:=a1+b1+c1; //převod na číslo pro výpočet
- a:=(pole[2,3][3]);b:=(pole[2,4][3]);c:=(pole[2,5][3]);
- a2:=StrToInt(a);b2:=StrToInt(b);c2:=StrToInt(c);y1:=a2+b2+c2;
- x:=IntToStr(x1);y:=IntToStr(y1);pole[2,7]:=(x+p+y);
- if a1>a2 then s1:=s1+2 else if a1=a2 then s1:=s1+1; //vyhodnocení na body
- if b1>b2 then s1:=s1+2 else if b1=b2 then s1:=s1+1;
- if c1>c2 then s1:=s1+2 else if c1=c2 then s1:=s1+1;
- h[1]:=s1;x:=IntToStr(s1);pole[2,8]:=x;s1:=0;s2:=0;s3:=0;
- a:=(pole[3,2][1]);b:=(pole[3,4][1]);c:=(pole[3,5][1]); // 2.tym, stejny postup
- a1:=StrToInt(a);b1:=StrToInt(b);c1:=StrToInt(c);x1:=a1+b1+c1;
- a:=(pole[3,2][3]);b:=(pole[3,4][3]);c:=(pole[3,5][3]);
- a2:=StrToInt(a);b2:=StrToInt(b);c2:=StrToInt(c);y1:=a2+b2+c2;
- x:=IntToStr(x1);y:=IntToStr(y1);pole[3,7]:=(x+p+y);
- if a1>a2 then s1:=s1+2 else if a1=a2 then s1:=s1+1;
- if b1>b2 then s1:=s1+2 else if b1=b2 then s1:=s1+1;
- if c1>c2 then s1:=s1+2 else if c1=c2 then s1:=s1+1;
- h[2]:=s1;x:=IntToStr(s1);pole[3,8]:=x;s1:=0;s2:=0;s3:=0;
- a:=(pole[4,2][1]);b:=(pole[4,3][1]);c:=(pole[4,5][1]); {3.tym}
- a1:=StrToInt(a);b1:=StrToInt(b);c1:=StrToInt(c);x1:=a1+b1+c1;
- a:=(pole[4,2][3]);b:=(pole[4,3][3]);c:=(pole[4,5][3]);
- a2:=StrToInt(a);b2:=StrToInt(b);c2:=StrToInt(c);y1:=a2+b2+c2;
- x:=IntToStr(x1);y:=IntToStr(y1);pole[4,7]:=(x+p+y);
- if a1>a2 then s1:=s1+2 else if a1=a2 then s1:=s1+1;
- if b1>b2 then s1:=s1+2 else if b1=b2 then s1:=s1+1;
- if c1>c2 then s1:=s1+2 else if c1=c2 then s1:=s1+1;
- h[3]:=s1;x:=IntToStr(s1);pole[4,8]:=x;s1:=0;s2:=0;s3:=0;
- a:=(pole[5,2][1]);b:=(pole[5,3][1]);c:=(pole[5,4][1]); {4.tym}
- a1:=StrToInt(a);b1:=StrToInt(b);c1:=StrToInt(c);x1:=a1+b1+c1;
- a:=(pole[5,2][3]);b:=(pole[5,3][3]);c:=(pole[5,4][3]);
- a2:=StrToInt(a);b2:=StrToInt(b);c2:=StrToInt(c);y1:=a2+b2+c2;
- x:=IntToStr(x1);y:=IntToStr(y1);pole[5,7]:=(x+p+y);
- if a1>a2 then s1:=s1+2 else if a1=a2 then s1:=s1+1;
- if b1>b2 then s1:=s1+2 else if b1=b2 then s1:=s1+1;
- if c1>c2 then s1:=s1+2 else if c1=c2 then s1:=s1+1;
- h[4]:=s1;x:=IntToStr(s1);pole[5,8]:=x;
- for i:=1 to 5 do
- begin
- for j:=1 to 8 do
- begin
- write(' ',pole[i,j],' ');
- end;
- writeln;
- end;
- writeln('--------------------------------');
- writeln();
- writeln('Stupně vítězů');
- writeln('--------------------------------');
- p1[1]:=false;p1[2]:=false;p1[3]:=false;p1[4]:=false; //p1 = >jestli je aktualne MAX}
- p2[1]:=false;p2[2]:=false;p2[3]:=false;p2[4]:=false; //p2 = >jestli uz je umisteny}
- r:=0;
- repeat {celkovy}
- begin
- r:=r+1;
- mp:=0;
- i:=0;
- repeat {ZJISTENI MAX}
- begin i:=i+1;
- if (h[i]>mp) and (p2[i]=false) then mp:=h[i];
- {p1[i]:=true JE NEJVETSI}
- end;
- until i=4;
- j:=0;
- repeat j:=j+1; {MAX=== - JE VICE MAXU?}
- if (h[j]=mp) and (p2[j]=false) then p1[j]:=true;
- until j=4;
- {p1[i]:=true JE NEJVETSI}
- // kazdy ma sve poradi
- if ((p1[1])=true) and ((p2[1])=false) then begin writeln(r,'. misto - ',tymy[1]);p2[1]:=true end;
- if ((p1[2])=true) and ((p2[2])=false) then begin writeln(r,'. misto - ',tymy[2]);p2[2]:=true end;
- if ((p1[3])=true) and ((p2[3])=false) then begin writeln(r,'. misto - ',tymy[3]);p2[3]:=true end;
- if ((p1[4])=true) and ((p2[4])=false) then begin writeln(r,'. misto - ',tymy[4]);p2[4]:=true end;
- // 2 tymy stejne poradi
- if ((p1[1])=true) and ((p1[2])=true) and ((p2[1])=false) and ((p2[2])=false) then begin writeln(r,'.-',r+1,'. misto - ',tymy[1]);writeln(r,'.-',r+1,'. misto - ',tymy[2]);r:=r+1;p2[1]:=true;p2[2]:=true end;
- if ((p1[1])=true) and ((p1[3])=true) and ((p2[1])=false) and ((p2[3])=false) then begin writeln(r,'.-',r+1,'. misto - ',tymy[1]);writeln(r,'.-',r+1,'. misto - ',tymy[3]);r:=r+1;p2[1]:=true;p2[3]:=true end;
- if ((p1[1])=true) and ((p1[4])=true) and ((p2[1])=false) and ((p2[4])=false) then begin writeln(r,'.-',r+1,'. misto - ',tymy[1]);writeln(r,'.-',r+1,'. misto - ',tymy[4]);r:=r+1;p2[1]:=true;p2[4]:=true end;
- if ((p1[2])=true) and ((p1[3])=true) and ((p2[2])=false) and ((p2[3])=false) then begin writeln(r,'.-',r+1,'. misto - ',tymy[2]);writeln(r,'.-',r+1,'. misto - ',tymy[3]);r:=r+1;p2[2]:=true;p2[3]:=true end;
- if ((p1[2])=true) and ((p1[4])=true) and ((p2[2])=false) and ((p2[4])=false) then begin writeln(r,'.-',r+1,'. misto - ',tymy[2]);writeln(r,'.-',r+1,'. misto - ',tymy[4]);r:=r+1;p2[2]:=true;p2[4]:=true end;
- if ((p1[3])=true) and ((p1[4])=true) and ((p2[3])=false) and ((p2[4])=false) then begin writeln(r,'.-',r+1,'. misto - ',tymy[3]);writeln(r,'.-',r+1,'. misto - ',tymy[4]);r:=r+1;p2[3]:=true;p2[4]:=true end;
- //3 tymy stejne poradi
- if ((p1[1])=true) and ((p1[2])=true) and ((p1[3])=true) and ((p2[1])=false) and ((p2[2])=false) and ((p2[3])=false)
- then begin writeln(r,'.-',r+2,'. misto - ',tymy[1]);writeln(r,'.-',r+2,'. misto - ',tymy[2]);writeln(r,'.-',r+2,'. misto - ',tymy[3]);r:=r+2;p2[1]:=true;p2[2]:=true;p2[3]:=true end;
- if ((p1[1])=true) and ((p1[2])=true) and ((p1[4])=true) and ((p2[1])=false) and ((p2[2])=false) and ((p2[4])=false)
- then begin writeln(r,'.-',r+2,'. misto - ',tymy[1]);writeln(r,'.-',r+2,'. misto - ',tymy[2]);writeln(r,'.-',r+2,'. misto - ',tymy[4]);r:=r+2;p2[1]:=true;p2[2]:=true;p2[4]:=true end;
- if ((p1[1])=true) and ((p1[4])=true) and ((p1[3])=true) and ((p2[1])=false) and ((p2[4])=false) and ((p2[3])=false)
- then begin writeln(r,'.-',r+2,'. misto - ',tymy[1]);writeln(r,'.-',r+2,'. misto - ',tymy[4]);writeln(r,'.-',r+2,'. misto - ',tymy[3]);r:=r+2;p2[1]:=true;p2[4]:=true;p2[3]:=true end;
- if ((p1[4])=true) and ((p1[2])=true) and ((p1[3])=true) and ((p2[4])=false) and ((p2[2])=false) and ((p2[3])=false)
- then begin writeln(r,'.-',r+2,'. misto - ',tymy[4]);writeln(r,'.-',r+2,'. misto - ',tymy[2]);writeln(r,'.-',r+2,'. misto - ',tymy[3]);r:=r+2;p2[4]:=true;p2[2]:=true;p2[3]:=true end;
- // 4 tymy stejne poradi
- if ((p1[1])=true) and ((p1[2])=true) and ((p1[3])=true) and ((p1[4])=true) and ((p2[1])=false) and ((p2[2])=false) and ((p2[3])=false) and ((p2[4])=false)
- then begin writeln(r,'.-',r+3,'. misto - ',tymy[1]);writeln(r,'.-',r+3,'. misto - ',tymy[2]);writeln(r,'.-',r+3,'. misto - ',tymy[3]);writeln(r,'.-',r+3,'. misto - ',tymy[4]);p2[1]:=true;p2[2]:=true;p2[3]:=true;p2[4]:=true end;
- end;
- until (p2[1]=true) and (p2[2]=true) and (p2[3]=true) and (p2[4]=true); //dokud nejsou vsechny p2 true, tdiz dokud nejsou vsechny vyhodnoceni
- end.
Add Comment
Please, Sign In to add comment