| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
提出一个数学递推公式,只有部分正确还请大虾们指点。程序如下:
# include< iostream.h >
# include< math.h >
void main()
{
int a[10]={6,35};
for( int i=2; i<10; i++ )
a[i] = a[i-1]*6 - a[i-2];// 计算第一个数的递推公式;
for( i=0; i<10; i++ )
{
cout<<a[i]<<" ";
cout<<( sqrt( 1 + 8*pow(a[i],2) )-1 )/2;
cout<<endl;
}
}
// 注:此程序能够正确而快速的算出6个数据,后面的数据尽管也符合要求,但却不是按照顺序来的
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator