Pagini recente » Borderou de evaluare (job #728045) | Cod sursa (job #3199969) | Cod sursa (job #727525) | Cod sursa (job #3280589) | Cod sursa (job #446073)
Cod sursa(job #446073)
#include<cstdio>
using namespace std;
int n,v[1000];
void post()
{
for(int i=1;i<=n;i++) if( v[i] ) printf("%d ",i);
printf("%d\n");
}
void bec(int k)
{
for(int p=0;p<=1;p++)
{
v[k]=p;
if(k==n) post();
else bec(k+1);
}
}
int main()
{
freopen("submultimi.in","r",stdin);
freopen("submultimi.out","w",stdout);
scanf("%d",&n);
bec(1);
return 0;
}