// UVa 441 - Lotto
#include <iostream>
using namespace std;
int a[13], b[6];
int n;
void comb(int i, int j) {
if (i == 6) {
for (int k = 0; k < 5; k++)
cout << b[k] << " ";
cout << b[5] << endl;
} else {
for (int k = j; k <= n - (6 - i); k++) {
b[i] = a[k];
comb(i + 1, k + 1);
}
}
}
int main() {
cin >> n;
bool blank = false;
while (n != 0) {
for (int i = 0; i < n; i++)
cin >> a[i];
if (blank)
cout << endl;
comb(0, 0);
blank = true;
cin >> n;
}
return 0;
}
No comments:
Post a Comment