Am uitat sa nu pun la ultimul carcter " ", cred ca de asta nu mi-a luat nimic... #include <fstream.h> #include <math.h> int st(long x) {long y; y=int(sqrt(x*2)); if (y*(y+1)/2>x)return(y-1); return(y); } int main() {ifstream fin("teanc.in"); ofstream fout("teanc.out"); long n,i,x; fin>>n; x=st(n);char t=0; for(i=x;i>=1;i--) {fout<<i<<" ";if((i==(n-(x*(x+1)/2)))&&(t==0)){i++;t=1;}} fin.close(); fout.close(); return 0; }