Source Code
/*
 * Aur0Ra
 */
#include <bits/stdc++.h>
#include <string>
#define ll long long
#define sf scanf
#define pf printf
#define to(ww,u,v) for(int ww=u;ww<=v;ww++)
#define tor(ww,u,v) for(int ww=u;ww>=v;ww--)
#define B break
#define C continue
#define P push_back
#define Pb pop_back
#define E "\n"
#define F first
#define S second
//%[^\n]%*c
using namespace std;
void file()
{
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
}
const unsigned int inf=4294967295,inf1=1e9+7,inf2=1e9+9;
const int N=2e5+10,M=5010,mod=1e9+7;
int tc,n,a[N],sz;
ll x,sum,tmp=1;
vector <ll> v;
int main()
{
//    file();
//    sf("%d",&tc);
//    while(tc--)
//    {
//        sf("%d",&n);
//        
//    }
    sf("%lld",&x);
    while(sum!=x)
    {
        if(sum+tmp<=x)
        {
            sz++;
            sum+=tmp;
            v.P(tmp);
        }
        else
        {
            v[sz-1]+=x-sum;
            sum=x;
        }
        tmp++;
    }
    pf("%d\n",sz);
    to(i,0,sz-1)
        pf("%lld%c",v[i],i==sz-1?'\n':' ');
}
Copy
Want More! Aurora
GNU G++17
176 ms
22.4 MB
Accepted