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

这样都能超时!无语!

Posted by zzd at 2009-03-17 15:13:40 on Problem 1607
#include<iostream>
#include<stdio.h>
#define MAX 1000000
using namespace std;
int main()
{
	float i,j;
	float sum;
	int n;
    cout<<"Cards"<<"  "<<"Overhang"<<endl;
	while(scanf("%d",&n)&&(n>=0&&n<MAX))
	{
		j=2.0;
		sum=0.0;
		for(i=1;i<=n;i++)
		{
			sum+=1/j;
			j+=2;
		}
		printf("%5d%10.3f\n",n,sum);
	}
	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