今天出高考成绩了,祝今年高考的家伙能取得好成绩。今天研究的递推问题是折线分割平面问题:

https://vjudge.net/contest/382188#problem/D

 

 

#include <iostream>
using namespace std;
long long a[10005];
void sum()
{
a[1]=2;
a[2]=7;
for(int i=3;i<10000;i++)
{
a[i]=a[i-1]+i*4*2-3;
}
}
int main()
{
int c;
long long b;
cin>>c;
sum();
while(c--)
{
cin>>b;
cout<<a[b]<<endl;
}
return 0;
}

posted on 2020-07-23 17:46  sean1246  阅读(12)  评论(0编辑  收藏  举报