1032

/*
将一个数分成若干段,成绩最大

12 = 3 * 4 * 5
5 = 2 * 3
9 = 2 * 3 * 4
210  = 5 * 6 * 7
10 = 2 * 3 * 5
11 = 2 * 4 * 5

5 = 2 * 3
6 = 2 * 4
7 = 3 * 4
8 = 3 * 5
9 = 2 * 3 * 4
10 = 2 * 3 * 5
11 = 2 * 4 * 5
12 = 3 * 4 * 5
13 = 3 * 4 * 6
14 = 2 * 3 * 4 * 5


*/

// include file
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cctype>
#include <ctime>

#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <bitset>

#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <list>
#include <functional>

using namespace std;

// typedef
typedef __int64 LL;

// 
#define read freopen("in.txt","r",stdin)
#define write freopen("out.txt","w",stdout)

#define Z(a,b) ((a)<<(b))
#define Y(a,b) ((a)>>(b))

const double eps = 1e-6;
const double INFf = 1e100;
const int INFi = 1000000000;
const LL INFll = (LL)1<<62;
const double Pi = acos(-1.0);

template<class T> inline T sqr(T a){return a*a;}
template<class T> inline T TMAX(T x,T y)
{
	if(x>y) return x;
	return y;
}
template<class T> inline T TMIN(T x,T y)
{
	if(x<y) return x;
	return y;
}
template<class T> inline T MMAX(T x,T y,T z)
{
	return TMAX(TMAX(x,y),z);
}
template<class T> inline T MMIN(T x,T y,T z)
{
	return TMIN(TMIN(x,y),z);
}
template<class T> inline void SWAP(T &x,T &y)
{
	T t = x;
	x = y;
	y = t;
}


// code begin
int N,sum;
int stk[500],top;
int main()
{
	read;
	write;
	while(scanf("%d",&N)==1)
	{
		top = 0;
		sum = 0;
		for(int i=2;;i++)
		{
			sum += i;
			if(sum>N)
			{
				sum-=i;
				break;
			}
			stk[top++] = i;
		}
		for(int i=sum+1,j=top-1;i<=N;i++)
		{
			stk[j--]++;
			if(j<0)
				j = top-1;
		}
		printf("%d",stk[0]);
		for(int i=1;i<top;i++)
		{
			printf(" %d",stk[i]);
		}
		printf("\n");
	}
	return 0;
}

posted @ 2011-04-30 20:19  AC2012  阅读(157)  评论(0编辑  收藏  举报