题解
2025-04-13 11:28:54
发布于:四川
0阅读
0回复
0点赞
#include<bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
long long a[60] = {}, cnt = 5;
a[1] = 2;
for (int i = 2; i <= n; i++) {
a[i] = a[i - 1] + cnt;
cnt += 4;
}
cout << a[n];
return 0;
}/*
1 -> 2
2 -> 7
3 -> 16
4 -> 29
*/
这里空空如也
有帮助,赞一个