35 lines
580 B
C++
35 lines
580 B
C++
#include<cstdio>
|
|
#include<cstring>
|
|
#include<algorithm>
|
|
using namespace std;
|
|
|
|
double a[2500050];
|
|
|
|
void init()
|
|
{
|
|
double sum=0.0;
|
|
for(int i=1; i<100000001; i++)
|
|
{
|
|
sum+=1.0/i;
|
|
if(i%50==0) a[i/50]=sum; //每隔49个记录一次。
|
|
}
|
|
}
|
|
|
|
int main()
|
|
{
|
|
init();
|
|
int t,flag=1;
|
|
scanf("%d",&t);
|
|
while(t--)
|
|
{
|
|
int n;
|
|
scanf("%d",&n);
|
|
int f=n/50;
|
|
double ans=a[f];
|
|
for(int i=50*f+1; i<=n; i++) //很明显循环在50以内
|
|
ans+=1.0/i;
|
|
printf("Case %d: %.10lf\n",flag++,ans);
|
|
}
|
|
return 0;
|
|
}
|