hdu 1330 Deck

#include<bits/stdc++.h>
using namespace std;

int main()
{
    int n,i,t;
    double ans;
    printf("# Cards Overhang\n");
    while(~scanf("%d",&n))
    {
        ans=0;
        for(i=1;i<=n;i++)
        {
            ans+=1.0/(i*2);
        }
        printf("%5d %.3f\n",n,ans);
    }
    return 0;
}

你可能感兴趣的:(hdu 1330 Deck)