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 Gchris at 2006-12-10 11:56:53 on Problem 1517
#include <stdio.h>

int jie(int n )
{	int sum = 1 , i ;
	for( i = 1 ; i <= n ; i++ )
		sum *= i ;
	return sum ;
}

int main()
{
	int n = 9 , i = 0 ; 
	double sum = 1 ;
	printf("n e\n") ;
	printf("- -----------\n") ;
	printf("0 1\n1 2\n2 2.5\n3 2.666666667\n4 2.708333333\n") ;
 	for( i = 1 ; i <= 4  ; i++ )
	{	sum +=  1.0 / jie(i) ;			
	}
	for( i = 5 ; i <= n  ; i++ )
	{	sum +=  1.0 / jie(i) ;
		printf("%d %.9lf\n",i , sum ) ;
	
	}
	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