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

提交就WA,请高手看看

Posted by yyaadet at 2005-09-22 21:12:27 on Problem 2601
#include<stdio.h>
#define max 100

double ReturnCn(int n,double c[])
{
	int i=0,count=0;
	double sum=0.0;
	int temp=n;
    for(i=0;i<temp;i++)
    	{
	    	sum=sum+c[i];
    	}
	/*while(count<n)
	{
    	for(i=0;i<temp;i++)
    	{
	    	sum=sum+c[i];
    	}
    	temp--;
    	count++;
	}*/
	return sum;
}

int main()
{
	int n;
	while(scanf("%d",&n)==1)
	{
	double a0,a,a1;
	scanf("%lf%lf",&a0,&a);
	double *c=new double[max];
	int i;
	for(i=0;i<n;i++)
	{
		scanf("%lf",c+i);
	}
	/*double x=ReturnCn(n,c);
	printf("%0.2lf\n",x);*/
	a1=((a-a0)/(n+1))+a0-ReturnCn(n,c);
	printf("%0.2lf\n",a1);
	}
	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