Cod sursa(job #556062)

Utilizator chibicitiberiuChibici Tiberiu chibicitiberiu Data 15 martie 2011 21:50:37
Problema Submultimi Scor 100
Compilator cpp Status done
Runda Arhiva educationala Marime 0.35 kb
#include <stdio.h>
using namespace std;

int main()
{
    freopen("submultimi.in", "r", stdin);
    freopen("submultimi.out", "w", stdout);

    int n; scanf("%d", &n);
    int temp = 1<<n;

    for (unsigned i = 1; i < temp; i++)
    {
        for (int x=0; x < n; x++)
            if (i & (1<<x)) printf("%d ", x+1);
        printf("\n");
    }

    return 0;
}