| ||||||||||
| 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 | |||||||||
你这不折腾嘛,还要算通项出来,递推着做不行吗?In Reply To:不懂为什么wa,大牛们看看吧,谢谢啦:) Posted by:xd at 2005-05-24 17:40:53 > #include <iostream.h>
> #include <math.h>
> #include <iomanip.h>
> void main ()
> {
> int num,i,j;
> double sum,tmp;
> cin>>num;
> double *ptr=new double [num];
>
> for ( i=0;i<num;i++ )
> cin>>ptr[i];
>
> for ( i=0;i<num;i++ )//to sort;
> {
> for ( j=i;j<num;j++ )
> {
> if ( ptr[j]>ptr[i] )
> {
> tmp=ptr[j];
> ptr[j]=ptr[i];
> ptr[i]=tmp;
> }
> }
> }
>
> sum=pow ( ptr[0],1 / pow ( 2, num-1 ) );
>
> for ( i=1;i<num;i++ )
> {
> sum*=pow ( pow ( ptr[i],pow( 2,i-1 ) ),1 / pow ( 2, num-1 ) );
> }
>
> sum *= pow ( pow ( 2, pow( 2,num ) -2 ),1/pow ( 2,num-1 ) );
>
> cout<<setiosflags(ios::fixed)<<setprecision(3)<<sum<<endl;
> }
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator