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

Re:大牛看看为什么会错啊?打表法

Posted by kuzalid at 2009-10-07 10:32:38 on Problem 1607
In Reply To:大牛看看为什么会错啊?打表法 Posted by:hmh0512 at 2009-08-01 19:50:50
> #include <stdio.h>
> main()
> {
> 	long n,i;
> 	double a[100000];
> 	a[0]=0;
> 	for(i=1;i<100000;i++)
> 		a[i]+=a[i-1]+0.5/i;	
> 	printf("Cards  Overhang\n");
> 	while(scanf("%d",&n)!=EOF)
> 		printf("%5d     %.3lf\n",n,a[n]);
> }


for(i=1;i<100000;i++)
		a[i]+=a[i-1]+0.5/i;
你的程序解法本身有错误,i是以i+=2递增的,不是加1~~

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