题解 | #尼科彻斯定理#
尼科彻斯定理
http://www.nowcoder.com/practice/dbace3a5b3c4480e86ee3277f3fe1e85
int c(int n) { int i = n - 1; int c = i; if (i == 0) return 1; else { while (i) c += (--i); } return c; } void print(int n,int c) { int j = 0; if (n == 1) { printf("1"); } else { while (n-1) { j = 2 * c + 1; printf("%d+", j); c++; n--; }printf("%d", 2 * c + 1); } printf("\n"); } int main() { int n = 0; while (~scanf("%d", &n)) { print(n,c(n)); } return 0; }