Discover the best answers at Westonci.ca, where experts share their insights and knowledge with you. Discover in-depth answers to your questions from a wide network of professionals on our user-friendly Q&A platform. Connect with a community of professionals ready to help you find accurate solutions to your questions quickly and efficiently.

Se citesc trei numere naturale a b n. Să se afișeze, în ordine lexicografică, șirurile cu n elemente distincte din mulțimea {a, a + 1, ..., b}.

Problema 3910

Asta am facut eu si iau 0 puncte :
#include
using namespace std;

long long n, m;
int k, x[21], frecv[21];

void afis() {
for (int i = 1; i <= k; i++)
cout << x[i] << " ";
cout << "\n";
}
void back(int pas)
{
for (int i = n; i <= m; i++) {
if (!frecv[i]) {
x[pas] = i;
frecv[i] = 1;
if (pas < k) back(pas + 1);
else afis();
frecv[i] = 0;
}
}
}
int main()
{
cin >> n >> m >> k;
back(n);
return 0;
}

Sagot :

We appreciate your visit. Hopefully, the answers you found were beneficial. Don't hesitate to come back for more information. Thank you for visiting. Our goal is to provide the most accurate answers for all your informational needs. Come back soon. Thank you for choosing Westonci.ca as your information source. We look forward to your next visit.