litere

Se citesc n litere.Sa se formeze toate cuvintele de cate p litere formate din cele n litere astfel incat aceeasi litera sa nu se afle pe 2 pozitii alaturate. #include<iostream.h>#include<conio.h> int n,st[10],k,p;char…

Continue Readinglitere

font

  • Post author:
  • Post category:HTML
  • Post comments:0 Comments

Tag-ul font in HTML Tagul <font> este inca folosit, dar va fi indepartat din versiunile viitoare de HTML. Atribute: atribute efect exemplu size="numar" marimea fontului size="2" size="+numar" incrementeaza marimea fontului…

Continue Readingfont

intervale

Fisierul bac.txt contine pe prima linie un nr. natural nenul n, iar pe fiecare din urmatoarele n linii cate 2 nr intregi a si b, fiecare pereche reprezentand un interval…

Continue Readingintervale

combinari

//combinari#include<iostream.h>int st[20],n,k; void init(){int i;cout<<"n=";cin>>n;cout<<"k=";cin>>k;st[0]=0;} void tipar(int p){int j;for(j=1;j<=p;j++)cout<<st[j]<<" ";cout<<endl;} int solutie(int p){return (p==k);} void bkt(int p){int val;for (val=st[p-1]+1;val<=n;val++){st[p]=val;if(solutie(p))tipar(p);elsebkt(p+1);}} void main(){init();bkt(1);} {joscommentenable}

Continue Readingcombinari

aranjamente

//aranjamente#include<iostream.h>int st[20],n,k; void init(){int i;cout<<"n=";cin>>n;cout<<"k=";cin>>k;for(i=1;i<=n;i++) st[i]=0;} void tipar(int p){int j;for(j=1;j<=p;j++)cout<<st[j]<<" ";cout<<endl;} int valid(int p){int i,ok;ok=1;for(i=1;i<p;i++)if(st[p]==st[i]) ok=0; return ok;} int solutie(int p){return (p==k);} void bkt(int p){int val;for (val=1;val<=n;val++){st[p]=val;if (valid(p))if(solutie(p))tipar(p);elsebkt(p+1);}} void main(){init();bkt(1);}…

Continue Readingaranjamente

permutari

//permutari#include<iostream.h>int st[20],n; void init(){int i;cout<<"n=";cin>>n;for(i=1;i<=n;i++) st[i]=0;} void tipar(int p){int j;for(j=1;j<=p;j++)cout<<st[j]<<" ";cout<<endl;} int valid(int p){int i,ok;ok=1;for(i=1;i<p;i++)if(st[p]==st[i]) ok=0;return ok;} int solutie(int p){return (p==n);} void bkt(int p){int val;for (val=1;val<=n;val++){st[p]=val;if (valid(p))if(solutie(p))tipar(p);elsebkt(p+1);}} void main(){init();bkt(1);} {joscommentenable}

Continue Readingpermutari