Source Code
#include <bits/stdc++.h>
using namespace std;
int main(){
    long long x,sum=0;
    vector<int>v;
	cin>>x;
	for(int i=1;i<=x;i++)
	{
	    v.push_back(i);
	    sum+=i;
	    if(sum>=x)
	     break;
	}
	if(x)v[v.size() - 1]+=x;
	cout<<v.size()<<endl;
	for(auto i : v)cout<<i<<" ";
	puts("");
}
Copy
Want More! moathhamudah
GNU G++17
1 ms
240 KB
Wrong Answer