poj 1759
来源:互联网 发布:android 开启数据连接 编辑:程序博客网 时间:2024/05/18 01:58
#include<stdio.h>
#define exp 1e-6
double d[1000+16];
double A,res;
int N;
int judge(double x)
{
int i;
d[0]=A;
d[1]=x;
for(i=2;i<N;i++)
{
d[i]=2*(d[i-1]+1)-d[i-2];
if(d[i]<0)
return 0;
}
return 1;
}
int main(void)
{
double l,r,m;
scanf("%d%lf",&N,&A);
l=0;r=A;
while(r-l>exp)
{
m=(r+l)/2;
if(judge(m))
{
res=d[N-1];
r=m;
}
else
l=m;
}
printf("%.2lf\n",res);
}
0 0
- poj 1759
- poj 1759
- Poj 1759 (二分)
- POJ-1759-Garland
- POJ - 1759 Garland(二分)
- POJ
- poj
- POJ
- POJ
- poj
- poj
- POJ
- POJ
- poj
- POJ
- POJ
- POJ
- POJ
- 算法训练 前缀表达式
- 54. Spiral Matrix
- 安卓手机直读微软SQL 2000数据库 界面仿微信界面 点击按钮进入公司生产数据网站 可放大缩小左右前后滑动
- socked 笔记
- 中断/异常
- poj 1759
- 安卓双击事件
- Anaconda python 数据分析环境配置
- 【taotao】linux下安装redis
- BZOJ3136: [Baltic2013]brunhilda
- 【IPTV】烽火通信再次中标上海电信高清视讯平台项目
- [勇者闯LeetCode] 27. Remove Element
- [BZOJ]1051: [HAOI2006]受欢迎的牛
- 很多点击事件,通过方法减少使用findViewbyid