#include<iostream> using namespace std; int main(void) { int i=1; int n; cout<<"趁時間沒發覺"<<endl; cin>>n; int max = n; int g = 1; int N = n/2+1; int * f = new int[N+1]; f[1] = 1; i = 1; int i1 = i; int sum = f[1]; while(1) { g = 1; if(sum>max) { g = 0; } if(sum == max) { for(int k=i1; k<=i; k++) cout<<f[k]<<" "; cout<<endl; g = 0; } if(g && i<N) { i++; f[i] = i; sum = sum + f[i];continue; } else { i1++; i = i1; f[i] = i; sum = f[i]; if(i1<N) continue; else break; } } return 0; }