43 lines
542 B
C++
43 lines
542 B
C++
|
#include<iostream>
|
||
|
#include<cstdio>
|
||
|
using namespace std;
|
||
|
|
||
|
const int N=1e6+5;
|
||
|
const int size=100;
|
||
|
|
||
|
double hn[N];
|
||
|
|
||
|
void gethn(){
|
||
|
int i,j,k;
|
||
|
double temp;
|
||
|
hn[0]=0;
|
||
|
temp=0;
|
||
|
k=1;
|
||
|
for(i=1;i<=N;i++){
|
||
|
for(j=1;j<=size;j++){
|
||
|
temp+=(1.0)/k;
|
||
|
k++;
|
||
|
}
|
||
|
hn[i]=temp;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
double readhn(int x){
|
||
|
double ans;
|
||
|
int c=x%size;
|
||
|
ans=hn[x/size];
|
||
|
for(int i=x-c+1;i<=x;i++) ans+=1.0/i;
|
||
|
return ans;
|
||
|
}
|
||
|
|
||
|
int main(){
|
||
|
gethn();
|
||
|
int i,t,n;
|
||
|
scanf("%d",&t);
|
||
|
for(i=1;i<=t;i++){
|
||
|
scanf("%d",&n);
|
||
|
printf("Case %d: %.10lf\n",i,readhn(n));
|
||
|
}
|
||
|
return 0;
|
||
|
}
|