| 记录编号 | 
        309488 | 
        评测结果 | 
        AAAAAAAAAA | 
    
    
        | 题目名称 | 
        26.分组 | 
        最终得分 | 
        100 | 
            
    
    
        | 用户昵称 | 
         烟雨 | 
        是否通过 | 
        通过 | 
    
    
        | 代码语言 | 
        C++ | 
        运行时间 | 
        0.020 s  | 
    
    
        | 提交时间 | 
        2016-09-19 20:37:49 | 
        内存使用 | 
        0.35 MiB  | 
        
    
    
    
    		显示代码纯文本
		
		#include<fstream>
#include<algorithm>
using namespace std;
ifstream cin("dataa.in");
ofstream cout("dataa.out");
int n,m,i,j,k,f[1000][11],ar=0,l[11],h=0,t=0;
void jisuan(int x,int ans)
{
    if(x<m)
    {
        f[0][x]=max(ans/(m-x+1),1);
        ans-=1;
        x++;
        jisuan(x,ans);
    }
    return;
}
void g(int x)
{
    if(x==m)
    {
        if(n-h>=l[x-1])
        {
            ar++;
            t++;
            l[x]=n-h;
            for(k=1;k<=m;k++)
                f[ar][k]=l[k];
        }
    }
    if(x<m)
    {
        for(int u=max(l[x-1],1);u<=f[0][x];u++)
        {
            l[x]=u;
            h+=u;
            g(x+1);
            l[x]=0;
            h-=u;
        }
    }
}
int main()
{
    cin>>n>>m;
    l[0]=0;
    jisuan(1,n);
    g(1);
    cout<<t<<endl;
    for(i=1;i<=t;i++)
    {
        for(j=1;j<=m;j++)
            cout<<f[i][j]<<' ';
        cout<<endl;
    }
    cin.close();
    cout.close();
    return 0;
}