题解 | #公共子串计算#
尼科彻斯定理
http://www.nowcoder.com/practice/dbace3a5b3c4480e86ee3277f3fe1e85
参考了第一个高赞老哥的思路
#include <iostream>
using namespace std;
int main (){
int n, first_number; //n就是m, first_number是数组首项
while(cin >> n){
first_number = n*n - n + 1;
for(int i = 1; i <= n; i++){
cout << first_number;
if(i < n) cout<<"+";
first_number += 2;
}
cout << endl;
}
return 0;
}