题解 | #坐标移动#
尼科彻斯定理
http://www.nowcoder.com/practice/dbace3a5b3c4480e86ee3277f3fe1e85
#include <iostream>
#include <cstring>
using namespace std;
int main() {
int n, sum = 1, i;
cin >> n;
sum = n * n * n;
if (n % 2 == 1) {
for (i = 0; i < (n / 2); i++) {
cout << sum / n - (n / 2 - i) * 2 << "+";
}
cout << sum / n;
for (i = 1; i <= n / 2; i++) {
cout << "+" << sum / n + i * 2;
}
} else {
for (i = 1; i <= (n / 2); i++) {
cout << sum / n - (n / 2 - i) * 2 - 1 << "+";
}
for (i = 0; i < n / 2 - 1; i++) {
cout << sum / n + 1 + i * 2 << "+";
}
cout << sum / n + 1 + i * 2;
}
return 0;
}