program se_puso_critica; var a:integer; {fila} b:integer; {columna} xl:array[1..101,1..101]of integer; {matriz} i,k,j,o,c,Q,W,R: integer; {auxiliares} jj,oo: real; x:array[1..10000]of integer; {vector} begin writeln('engancha numero de fila entre 1 y 100'); repeat read(a); {fila} if (a<1) or (a>100) then writeln('puta que eri weon, ingresa algo entre 1 y 100'); until (a>=1) and (a<=100); {---------------------------------------------} writeln('ahora suelta una columna'); repeat read(b); {columna} if (b<1) or (b>100) then writeln('hermano enserio no ando na pa que me wei'); until (b>=1) and (b<=100); {---------------------------------------------} o:=a*b; writeln('pasa ',o,' numeros plox'); for i:=1 to o do {vector para rellenar la matriz} readln(x[i]); {---------------------------------------------} c:=1; for i:=1 to a do begin for k:=1 to b do begin {matriz rellenada} xl[i,k]:=x[c]; c:=c+1; end; end; {---------------------------------------------} for i:=1 to a do begin for k:=1 to b do begin write(xl[i,k],' '); {matriz escrita} end; writeln; end; {---------------------------------------------} j:=0; for i:=1 to o do begin j:=j+x[i]; {promedio de valores de la matriz} end; jj:=j; oo:=o; jj:=jj / oo; writeln('le promedio es ',jj:0:2,' c:'); {---------------------------------------------} Q:=0; for i:=1 to o do begin if x[i]>jj then begin Q:=Q+1; end; end; writeln('la cantidad de numeros mayores al promedio son ',Q); {----------------------------------------------} W:=x[1]; for i:=1 to o do begin if (x[i])<(W) then {calcula el numero menor} W:=x[i]; end; writeln('el menor numero de la matriz es ',W); {-----------------------------------------------} R:=x[1]; for i:=1 to o do begin {calcula el numero mayor} if (x[i])>(R) then R:=x[i]; end; writeln('el mayor numero de la matriz es ',R); readln; readln; {------------------------------------------------} end.
Program NOIP_program_03; var n,s,i :longint; a,t :array[0..100005] of longint; procedure mergesort(l,r : longint); var mid,p,i,j :longint; begin if (l=r) then exit; mid:= (l+r) div 2; p:=1; i:=1; j:=mid + 1; mergesort(l, mid); mergesort(mid +1, r); while (i<= mid) and (j<= r) do begin if (a[j] <a[i]) then begin s:= s+ mid-i+1; t[p]:= a[j]; p:= p+1; j:= j+1; end else begin t[p] := a[i]; p:= p+1; i:= i+1; end; end; while (i<= mid) do begin t[p]:= a[i]; p:= p+1; i:= i+1; end; while (j<= r) do begin t[p]:= a[j]; p:= p+1; j:= j+1; end; for i:= l to r do a[i]:= t[i]; end; begin read(n); for i:= 1 to n do read(a[i]); writeln; writeln; mergesort(1,n); writeln(s); end.
program Tim_max; var a,b,c,d, max : integer; begin writeln('meo con di tim so lon nhat trong cac so sau nhe'); write ('nhap so a: '); readln(a); write ('nhap so b: '); readln(b); write ('nhap so c: '); readln(c); write ('nhap so d: '); readln(d); max:=a; if b>max then max:=b; if c>max then max:=c; if d>max then max:=d; writeln ('vay so lon nhat trong 4 so: ',a,', ',b,', ',c,', ',d,' la: ',max); readln; end.
Program start; var respone :integer; procedure BubbleSort( var a: array of TItemBubbleSort ); implementation procedure swap( var a, b:TItemBubbleSort ); var temp : TItemBubbleSort; begin temp := a; a := b; b := temp; end; procedure BubbleSort( var a: array of TItemBubbleSort ); var n, newn, i:integer; begin n := high( a ); repeat newn := 0; for i := 1 to n do begin if a[ i - 1 ] > a[ i ] then begin swap( a[ i - 1 ], a[ i ]); newn := i ; end; end ; n := newn; until n = 0; end; writeln('1. Bubble Sort'); writeln('2. Insertion Sort'); writeln('3. Merge Sort'); writeln('4. Quick Sort'); writeln('5. Exit'); readln(response); while response <> 5 do begin writeln('1. Bubble Sort'); writeln('2. Insertion Sort'); writeln('3. Merge Sort'); writeln('4. Quick Sort'); writeln('5. Exit'); readln(response); case response of '1': Bubble; '2': Insertion; '3': Merge; '4': Quick; '5': writeln('Thanks for using this program!') end; end; end.
Program Schelifen (output); var zaehler: integer; begin writeln('FOR Schleife'); for zaehler:=1 to 5 do begin writeln('5 mal ',zaehler,' = ',zaehler*5); end; writeln(); writeln('REPEAT Schleife'); zaehler:=1; repeat begin writeln('5 mal ',zaehler,' = ',zaehler*5); zaehler:=zaehler+1; end; until zaehler>5; writeln(); writeln('WHILE Schleife'); zaehler:=1; while (zaehler<6) do begin writeln('5 mal ',zaehler,' = ',zaehler*5); zaehler:=zaehler+1; end; end.
Program wuerfel (output); var i: integer; var w1,w2:integer; var p:integer; begin p:=0; (* randomize; *) for i:=1 to 100 do begin w1:=random(6); w2:=random(6); if w1=w2 then begin writeln(w1,' ',w2,' ',w1+w2,' Pasch!'); p:=p+1; end else writeln(w1,' ',w2,' ',w1+w2); end; writeln('Anzahl Pasch: ',p); end.
Program procedure_function; uses crt; type mas=array[1..20] of integer; var ms1,ms2:mas; rms1,rms2:integer; function
program Practica3.1; var nota:integer; begin writeln ("Escriba tu nota"); read(nota); if nota=20 write ("M. Honor"); else if nota=19 or nota=18 write ("Sobresaliente"); else if nota=17 or nota=16 write ("Notable"); else if nota=15 or nota=14 wirte ("Aprobado"); else write ("suspenso"); end.
program p6; {afisarea a patru numere,in care se dubleza cel mai mare si se tripleaza cel mai mic} var a,b,c,d:real; begin writeln('introduceti valorile a,b,c,d:'); readln(a,b,c,d); if (a>b) and (a>c) and (a>d) and (d<a) and (d<b) and (d<c) then writeln(a*2,' ',b,' ',c,' ',d*3,' '); if (a>b) and (a>c) and (a>d) and (c<a) and (c<b) and (c<d) then writeln(a*2,' ',b,' ',c*3,' ',d,' '); if (a>c) and (a>b) and (a>d) and (d<a) and (d<c) and (d<b) then writeln(a*2,' ',b,' ',c,' ',d*3,' '); if (a>c) and (a>d) and (a>b) and (b<a) and (b<c) and (b<d) then writeln(a*2,' ',b*3,' ',c,' ',d,' '); if (a>d) and (a>b) and (a>c) and (c<a) and (c<d) and (c<b) then writeln(a*2,' ',b,' ',c*3,' ',d,' '); if (a>d) and (a>c) and (a>b) and (b<a) and (b<d) and (b<c) then writeln(a*2,' ',b*3,' ',c,' ',d,' '); if (b>a) and (b>c) and (b>d) and (d<b) and (d<a) and (d<c) then writeln(a,' ',b*2,' ',c,' ',d*3,' '); if (b>a) and (b>c) and (b>d) and (c<b) and (c<a) and (c<d) then writeln(a,' ',b*2,' ',c*3,' ',d,' '); if (b>c) and (b>a) and (b>d) and (d<b) and (d<c) and (d<a) then writeln(a*2,' ',b,' ',c,' ',d*3,' '); if (b>c) and (b>d) and (b>a) and (a<b) and (a<c) and (a<d) then writeln(a*3,'',b*2,' ',c,' ',d,' '); if (b>d) and (b>a) and (b>c) and (c<b) and (c<d) and (c<a) then writeln(a,' ',b*2,' ',c*3,' ',d,' '); if (b>d) and (b>c) and (b>a) and (a<b) and (a<d) and (a<c) then writeln(a*3,' ',b*2,' ',c,' ',d,' '); if (c>a) and (c>b) and (c>d) and (d<c) and (d<a) and (d<b) then writeln(a,' ',b,' ',c*2,' ',d*3,' '); if (c>a) and (c>b) and (c>d) and (b<c) and (b<a) and (b<d) then writeln(a*2,' ',b*3,' ',c*2,' ',d,' '); if (c>b) and (c>a) and (c>d) and (d<c) and (d<b) and (d<a) then writeln(a,' ',b,' ',c*2,' ',d*3,' '); if (c>b) and (c>d) and (c>a) and (a<c) and (a<b) and (a<d) then writeln(a*3,' ',b,' ',c*2,' ',d,' '); if (c>d) and (c>a) and (c>b) and (b<c) and (b<d) and (b<a) then writeln(a,' ',b*3,' ',c*2,' ',d,' '); if (c>d) and (c>b) and (c>a) and (a<c) and (a<d) and (a<b) then writeln(a*3,' ',b,' ',c*3,' ',d,' '); if (d>a) and (d>b) and (d>c) and (c<d) and (c<a) and (c<b) then writeln(a,' ',b,' ',c*3,' ',d*2,' '); if (d>a) and (d>b) and (d>c) and (b<d) and (b<a) and (b<c) then writeln(a,' ',b*3,' ',c*3,' ',d*2,' '); if (d>b) and (d>a) and (d>c) and (c<d) and (c<b) and (c<a) then writeln(a,' ',b,' ',c*3,' ',d*2,' '); if (d>b) and (d>c) and (d>a) and (a<d) and (a<b) and (a<c) then writeln(a*3,' ',b,' ',c,' ',d*2,' '); if (d>c) and (d>a) and (d>b) and (b<d) and (b<c) and (b<a) then writeln(a,' ',b*3,' ',c*3,' ',d*2,' '); if (d>c) and (d>b) and (d>a) and (a<d) and (a<c) and (a<b) then writeln(a*3,' ',b,' ',c,' ',d*2,' '); end.
We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy. Accept Learn more