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 v[10]; int valid(int k){if((k>1) && (st[k]==st[k-1])) return 0;return 1;} int sol(int k){return (k==p);} void tipar(int p){for(int i=1;i<=p;i++)cout<<v[st[i]];cout<<endl;} void bkt(int k){ for(int val=1;val<=n;val++){st[k]=val;if (valid(k)) if (sol(k)) … Read more