Pagini recente » Cod sursa (job #3147577) | Cod sursa (job #3038586) | Cod sursa (job #3038779) | Cod sursa (job #1410492) | Cod sursa (job #2787635)
#include <fstream>
using namespace std;
ifstream fin("submultimi.in");
ofstream fout("submultimi.out");
int n, x[17];
void Afisare(int k){
for(int i = 1; i <= k; ++ i)
fout << x[i] << ' ';
fout << '\n';
}
void Back(int k){
for(int i = x[k - 1] + 1; i <= n; ++ i){
x[k] = i;
Afisare(k);
if(k < n)
Back(k + 1);
}
}
int main(){
fin >> n;
Back(1);
fin.close();
fout.close();
return 0;
}