ZOJ Problem Set

#include <stdio.h>

int main()
{
    double table[100001];
    double t=2.0;
    table[1]=0.5;
    
    for(int i=2;i<100001;i++)
    {
        t+=2;
        table[i]=table[i-1]+1.0/t;
    }

    printf("# Cards  Overhang
");
    int n;
    while(scanf("%d",&n)!=EOF)
    {
        printf("%5d%10.3lf
",n,table[n]); 
    }

    return 0;
}
原文地址:https://www.cnblogs.com/xlturing/p/3327481.html