#include<stdio.h> #include<stdlib.h> #include<math.h> int main() { int n; int N = 100; while(scanf("%d",&n)!=EOF) { int a[100]={0}; int num = pow(n, 3); int tmp = pow(n, 2); int sum =0; int t; if(tmp%2==0)//根据n的平方是否为偶数分为两种情况 { a[0] = tmp-1; a[1] = tmp+1; } else { a[0] = tmp; } int k = 2; while(sum!=num) { sum = 0; if(tmp%2==0) { a[k] = a[0]-(k); a[k+1] = a[1]+(k); } else { a[k] = a[0]-(k); a[k+1] = a[0]+(k); } k+=2; for(int i = 0;i<N;i++) { sum+=a[i]; } } for(int i = 0;i<N;i++)//对找到的结果进项排序输出 { for(int j = i+1;j<N;j++) { if(a[i]>a[j]) { t = a[i]; a[i] = a[j]; a[j] = t; } } } for(int i=0;i<N-1;i++) { if(a[i]==0) continue; else { printf("%d",a[i]); printf("+"); } } printf("%d\n",a[N-1]); } return 0; }