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

为什么RTE呢?

Posted by 00 at 2006-05-17 00:49:52 on Problem 2601
#include<iostream.h>
#include<iomanip.h>
int n;
double *c;
double x,y;
double a(int i)
{
	if(i==0)
		return x;
	if(i==n+1)
		return y;
	return (a(i-1)+a(i+1))/2-c[i-1];
}
void main()
{
	cin>>n;
	if(n!=0)
		c=new double [n];
	cin>>x>>y;
	for(int i=0;i<n;i++)
		cin>>c[i];
	cout<<setiosflags(ios::fixed);
	if(n==0)
	{
		cout<<setprecision(2)<<y<<endl;
		return;
	}
	cout<<setprecision(2)<<a(1)<<endl;
	delete [] c;
}

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