UVA13221
1 1
2 3
3 7
4 11
5 17
6 23
7 31
规律不难发现,递推式为:
最后献上我的代码:
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main () {
ll n;
while(cin>>n) {
ll p=(n+1)*(n+1)/2-1;
cout<<p;
cout<<endl;
}
return 0;
}