Skip to content

Instantly share code, notes, and snippets.

@taikoubou
Created December 12, 2013 16:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save taikoubou/7931032 to your computer and use it in GitHub Desktop.
Save taikoubou/7931032 to your computer and use it in GitHub Desktop.
#include<iostream>
using namespace std;
typedef long long int lli;
void solve(int,int,int,int,int[]);
lli N,K,Q;
int memo[210][210];
int main(){
cin >> N >> K >> Q;
int m[201];
solve(0,1,N-1,K,m);
for(int i=0;i <= N;i++){
for(int j=0;j <= K;j++){
cout << memo[i][j];
}
cout << endl;
}
return 0;
}
void solve(int n,int c,int l,int m,int h[]){
for(int i=n;i<=m+2+c;i++){
h[c]=i;
if(l != c)solve(i,c+1,l,m,h);
else{
for(int j=1;j<=l;j++)memo[n][j] = h[j];
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment