Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
这样都能超时!无语!#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator