编辑代码

#include <stdio.h>

int getSimpleCount(int n, int m)
{
    if((n<=0)||
            (m<0))
    {
        return 0;
    }

    if(0 == m)
    {
        return 1;
    }

    int nResult = 1;

    int x = m;
    n -= m;
    while(n>=x)
    {
        nResult += getSimpleCount(n, x);
        x++;
        n--;
    }

    return nResult;
}

int main()
{
    for(;;)
    {
       int n = 0;
       scanf("%d", &n);
       if(0 == n)
       {
           return 0;
       }
       int nResult = getSimpleCount(n, 1);
       printf("%d\n", nResult);
    }
    return 0;
}