Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

哪位大大提示一下思路吧!

Posted by rencv at 2005-10-31 16:42:09 on Problem 2651
//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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator