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

用GCC 一直WA,换成C++ 一次就AC???

Posted by wolaoa at 2011-12-04 22:10:52 on Problem 2601
#include <stdio.h>
#include <stdlib.h>

int main()
{
	int n;	
	double c[3002]={0};
	double a0,an;
	scanf("%d",&n);
	scanf("%lf%lf",&a0,&an);
	double sum=0;
	int i;
	for(i=0;i<n;i++)
	{
		scanf("%lf",&c[i]);
		sum += 2*(n-i)*c[i];
	}
	double a1 = (n*a0+an-sum)/(n+1);
	printf("%.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