代码
#include <cstdio>
#include <iostream>
#include <cstring>
using namespace std;
int sum(0),a[20005],n,i,ma;
int main(){
cin>>n;
for(i=2;sum+i<n;i++){
a[i-1]=i;
sum+=i;
}
sum+=i;
a[i-1]=i;
ma=i-1;
if(sum-n==0){
for(i=1;i<=ma;i++){
printf("%d ",a[i]);
}
printf("\n");
}else if(sum-n==1){
for(i=2;i<ma;i++){
printf("%d ",a[i]);
}
printf("%d",a[i]+1);
printf("\n");
}else if(sum-n>1){
for(i=1;i<=ma;i++){
if(sum-n!=a[i]){
printf("%d ",a[i]);
}
}
printf("\n");
}
}