| 记录编号 | 
        218594 | 
        评测结果 | 
        AAAAAAAAAA | 
    
    
        | 题目名称 | 
        26.分组 | 
        最终得分 | 
        100 | 
            
    
    
        | 用户昵称 | 
         Riolu | 
        是否通过 | 
        通过 | 
    
    
        | 代码语言 | 
        C++ | 
        运行时间 | 
        0.003 s  | 
    
    
        | 提交时间 | 
        2016-01-10 13:25:18 | 
        内存使用 | 
        23.21 MiB  | 
        
    
    
    
    		显示代码纯文本
		
		#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
int ans[3000][2000];
int k=0;
int tmp[2000],n,m;
void dfs(int step,int n){
	if(n<0) return ;
	if(step==m+1&&n==0){
		k++;
		for(int i=1;i<=m;i++)
			ans[k][i]=tmp[i];
		return ;
			}
	int i;
	for(i=tmp[step-1];i<=n;i++){
		tmp[step]=i;
		dfs(step+1,n-i);
		}
	}
int main()
{
	freopen("dataa.in","r",stdin);
	freopen("dataa.out","w",stdout);
	cin>>n>>m;
	tmp[0]=1;
	dfs(1,n);
	cout<<k<<endl;
	for(int i=1;i<=k;i++){
		for(int j=1;j<=m;j++)
			printf("%d ",ans[i][j]);
		cout<<endl;
		}
	return 0;
}