啊题解
2025-04-15 18:11:41
发布于:四川
1阅读
0回复
0点赞
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin >> n;
while(n--){
int k;
cin >> k;
long long a[10005] = {};
a[1] = 2;
for(int i = 2; i <= k; i++) {
a[i] = a[i - 1] + (i - 1) * 2;
}
cout << a[k] << endl;
}
return 0;
}
这里空空如也
有帮助,赞一个