| ||||||||||
| 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 | |||||||||
我觉得是精度问题吧,最后的结果连int64也放不下的In Reply To:2084 请教一个简单题:关于母函数的,为什么会出错,觉得没错呀? Posted by:bjtu01281229 at 2005-05-20 03:25:48 > #include <iostream>
> #include <math.h>
> using namespace std;
>
> int main()
> {
> double p,y;
> double c1=(5-sqrt(double(5)))/10,c2=(5+sqrt(double(5)))/10,d1=(3+sqrt(double(5)))/2,d2=(3-sqrt(double(5)))/2;
> cin>>y;
> while(y!=-1)
> { p=c1*pow(d1,y)+c2*pow(d2,y);
> cout<<p<<endl;
> cin>>y;
> }
> return 0;
> }
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator