| 记录编号 | 
        244299 | 
        评测结果 | 
        AAAAAAAAAA | 
    
    
        | 题目名称 | 
        26.分组 | 
        最终得分 | 
        100 | 
            
    
    
        | 用户昵称 | 
         Rapiz | 
        是否通过 | 
        通过 | 
    
    
        | 代码语言 | 
        C++ | 
        运行时间 | 
        0.013 s  | 
    
    
        | 提交时间 | 
        2016-03-31 18:08:01 | 
        内存使用 | 
        9.85 MiB  | 
        
    
    
    
    		显示代码纯文本
		
		#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
const int MAXM=10+1;
int m,n,a[MAXM],sz=1,ans;
char str[10000000];
void dfs(int k=0,int l=n){//已经分了k组,剩下l 
	if(k==m) {
		if(l!=0) return;
		ans++;
		for(int i=1;i<sz;i++) sprintf(str+strlen(str),"%d ",a[i]);
		sprintf(str+strlen(str),"\n");
	}
	else for(int i=a[sz-1];i<=l;i++) a[sz++]=i,dfs(k+1,l-i),sz--;
}
int main(){
	freopen("dataa.in","r",stdin);
	freopen("dataa.out","w",stdout);
	a[0]=1;
	cin>>n>>m;
	dfs();
	cout<<ans<<endl;
	cout<<str;
}