0分求助!
  • 板块学术版
  • 楼主poor_OIer
  • 当前回复3
  • 已保存回复3
  • 发布时间2024/7/21 22:53
  • 上次更新2024/7/22 09:14:41
查看原帖
0分求助!
704634
poor_OIer楼主2024/7/21 22:53

P10781 【MX-J1-T1】『FLA - III』Spectral

#include<bits/stdc++.h>
#define int long long
using namespace std;
int T,n,k;
double ans=-1.0;
inline int read()
{
	int x=0,f=1;
	char ch=getchar();
	while(ch<'0'||ch>'9')
	{
		if(ch=='-')
			f=-1;
		ch=getchar();
	}
	while(ch>='0'&&ch<='9')
	{
		x=(x<<3)+(x<<1)+(ch^48);
		ch=getchar();
	}
	return x*f;
}
signed main()
{
	T=read();
	while(T--)
	{
		n=read(),k=read();
		double tem=0;
		for(int i=1;i<=n;i++)
		{
			tem=tem/i+k;
			if(tem>ans)
				ans=tem;
		}
		printf("%.1lf\n",ans);
	}
	return 0;
}
2024/7/21 22:53
加载中...