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:牛人们帮帮忙啊,就是过不了,郁闷啊~~急救!!!wrong

Posted by aantelov at 2006-08-01 08:40:46 on Problem 1517
In Reply To:牛人们帮帮忙啊,就是过不了,郁闷啊~~急救!!!wrong Posted by:cpp051000448166 at 2005-04-29 15:09:11
> #include <iostream>
> #include <iomanip>
> using namespace std;
> int i;
> double a[10],s[10];
> int jie(int n)
> {
> 	int sum=1;
> 	for(int i1=1;i1<=n;i1++)
> 	{
> 		sum=sum*i1;
> 	}
> 	return sum;
> }
> double add(double p[],int n)
> {
> 	double sum;
> 	for(int i2=0;i2<=n;i2++)
> 		sum+=p[i2];
> 	return sum;
> }
> 
> void main()
> {
> 	a[0]=1;
> 	for(i=1;i<10;i++)
> 	{
> 		a[i]=(double)1/jie(i);
> 	}
> 	cout<<"n e"<<endl;
> 	cout<<"- -----------"<<endl;
> 	for(i=0;i<10;i++)
> 	{
> 		s[i]=add(a,i);
> 	}
> 	for(i=0;i<3;i++)
> 	{
> 		cout<<i<<" "<<s[i]<<endl;
> 	}
> 	for(i=3;i<10;i++)
> 	{
> 		cout<<i<<" "<<setiosflags(ios::fixed)<<setprecision(9)<<s[i]<<endl;
> 	}
> }

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