/* ***********************************************
Author :xryz
Email :523689985@qq.com
Created Time :4-26 12:05:01
File Name :zoj3696.cpp
************************************************ */
#include <stdio.h>
#include <string.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <math.h>
#include <stdlib.h>
#include <time.h>
using namespace std;
int main()
{
int T,i,n;
double ans,q;
scanf("%d",&T);
while(T--)
{
scanf("%d %lf",&n,&q);
double t=exp(-q);
ans=t;
for(i=1;i<=n;i++)
{
t*=q/i;
ans+=t;
}
printf("%.3f
",ans);
}
return 0;
}
版权声明:本文为博主原创文章,未经博主允许不得转载。http://xiang578.top/