Postări

Divide et Impera: Interclasare vs Farey

PROGRAM Sortare_prin_Interclasare; TYPE vector=array[1..100] of integer; Var a:vector;     n,i:integer; Procedure sort(p,q:integer;var a:vector); var aux:integer; Begin if(a[p]>a[q]) then                   begin                    aux:=a[p];                    a[p]:=a[q];                    a[q]:=aux;                   end; End; Procedure interclasare(p,q,m:integer;var a:vector); var c:vector;     i,j,k:integer; Begin i:=p; j:=m+1; k:=1; while((i<=m)and(j<=q)) do  if(a[i]<=a[j]) then                     begin                      c[k]:=a[i];             ...

Descompunere numar in suma de numere

UNIT Des; INTERFACE Uses Graph,Crt; Type Vd=array[0..500] of word; Var sol,sl2:Vd; i,dist,nr,v_intr:Word; gd,gm,vdd,xd,clk:integer; p,c,cont,val_i,opt:word; Procedure Desen(sl:Vd;p:word); Procedure InitGR; Procedure Concluzii_GR; Procedure Meniu; IMPLEMENTATION Procedure Meniu; Begin {clrscr;} Writeln(' ~ MENIU ~'); Writeln(' 1. Text'); Writeln(' 2. Grafic'); Writeln(' Alegeti o optiune : '); Readln(opt); if not (opt in [1..2]) then Begin TextColor(LightRed); Writeln('Eroare la intr opt '); sound(350); Delay(3500); nosound; TextColor(15); Halt; End; clrscr; End; Procedure InitGR; Begin gd:=0; dist:=0; Write('Intr val pt DELAY -> recomandari : min (nr*p)^2 , pt nr mici :'); Readln(v_intr); Initgraph(gd,gm,'c:\bp\bgi'); setviewport(0,10,getmaxx-10,500,true); End; Procedure DesHis3D(v:word); Begin Bar3d(xd,vdd-v*10,10+xd,vdd,10,true); dist:=dist+15; End; Procedure Desen(sl:Vd;p:word); Begin dist...