#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false), cin.tie(0);
#define rep(i, n) for (int i = 0; i < (n); i++)
typedef long long LL;
typedef pair<int, int> PII;
typedef vector<int> vi;
//const int N=;
int main()
{
IOS
int n;
cin>>n;
int t=n*(n-1)+1;
for(int i=0; i<n; i++)
cout<<t+2*i<<"+\n"[i==n-1];
return 0;
}
从题面可以看到,n为几就有几项,然后是连续奇数的和形式,第一个奇数为n*(n-1)+1
循环输出即可,n比较小,不会溢出int

京公网安备 11010502036488号