题解 | #尼科彻斯定理#
尼科彻斯定理
https://www.nowcoder.com/practice/dbace3a5b3c4480e86ee3277f3fe1e85
#include <stdio.h>
#include <math.h>
int main() {
int m = 0;
double m_2 = 0.0;
int ret = 0;
while (scanf("%d", &m) != EOF) { // 注意 while 处理多个 case
m_2 = pow(m, 2);
ret = m_2 - m + 1;
for (int i = 0; i < m; i++, ret += 2){
if (ret % 2 != 0){
printf("%d",ret);
}else{
ret++;
printf("%d",ret);
}
if (i != m-1){
printf("%c", '+');
}
}
printf("\n");
}
return 0;
}
