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 |
哪位大大提示一下思路吧!//WA #include <stdio.h> int main() { double pp, t, arr[100]; int i, n; while( scanf("%d%lf",&n,&t) && n ) { arr[0] = 1.0; for( i = 1; i <= n; i++ ) { pp = 1.0 / ( arr[i-1] + 1.0 ); if( t >= pp ) { arr[i] = 1.0 + t; arr[i] *= arr[i-1]; } else { arr[i] = ( pp - t ) / ( 1.0 - t ) + ( 1.0 - pp ) / ( 1.0 - t ) * ( 1.0 + pp ); arr[i] *= arr[i-1]; } } printf("%.3lf\n",(arr[n])); } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator