题解 | #尼科彻斯定理#
尼科彻斯定理
http://www.nowcoder.com/practice/dbace3a5b3c4480e86ee3277f3fe1e85
```import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
while (sc.hasNext()) {
int n = sc.nextInt();
int m = n * n * n;
ArrayList<Integer> list = new ArrayList<>();
if(n == 1){
System.out.println("1");
continue;
}
for (int i = n / 2; i > 0; i--) {
if (n % 2 == 0) {
list.add(n * n - 1 - 2 * (i - 1));
list.add(n * n + 1 + 2 * (i - 1));
} else {
if (i == 1) {
list.add(n * n);
}
list.add(n * n - 2 * i);
list.add(n * n + 2 * i);
}
}
Collections.sort(list);
for (int i = 0; i < list.size(); i++) {
if (i == list.size() - 1) {
System.out.println(list.get(i));
} else {
System.out.print(list.get(i) + "+");
}
}
}
}
}