Pagini recente » Cod sursa (job #243189) | Cod sursa (job #2318078) | Cod sursa (job #87895) | Cod sursa (job #1243479) | Cod sursa (job #1442291)
#define REP(a,b) for(int a=0; a<(b); ++a)
#define FWD(a,b,c) for(int a=(b); a<(c); ++a)
#define FWDS(a,b,c,d) for(int a=(b); a<(c); a+=d)
#define BCK(a,b,c) for(int a=(b); a>(c); --a)
#define ALL(a) (a).begin(), (a).end()
#define SIZE(a) ((int)(a).size())
#define VAR(x) #x ": " << x << " "
#define FILL(x,y) memset(x,y,sizeof(x))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define MAX(a,b) (((a)>(b))?(a):(b))
#define x first
#define y second
#define st first
#define nd second
#define pb push_back
#define nleft (n<<1)
#define nright (nleft+1)
#include<vector>
#include<algorithm>
using namespace std;
#include<fstream>
ifstream cin("combinari.in");
ofstream cout("combinari.out");
#define NMAX 20
typedef long long LL;
typedef pair<int, int> PII;
typedef long double K;
typedef pair<K, K> PKK;
typedef vector<int> VI;
const int dx[] = {0,0,-1,1}; //1,1,-1,1};
const int dy[] = {-1,1,0,0}; //1,-1,1,-1};
bool viz[NMAX];
int sol[NMAX];
int n,m,i,j,k;
void print()
{
REP(i,k)
cout<<sol[i]<<" ";
cout<<"\n";
}
void back(int lvl)
{
if(lvl==k)
print();
else
FWD(i,sol[lvl-1]+1,n+1)
{
if(!viz[i]){
viz[i]=true;
sol[lvl]=i;
back(lvl+1);
viz[i]=false;
}
}
}
int main()
{
cin>>n>>k;
back(0);
return 0;
}