http://poj.org/problem?id=3122

 #include<cstdio>
#include<cstring>
#include<cmath>
#define maxn 10010
#include<algorithm>
using namespace std; const double pi=acos(-1.0);
const double eps=1e-;
double r[maxn];
int n,f; int main()
{
int t;
scanf("%d",&t);
while(t--){
double max1=;
scanf("%d%d",&n,&f);
f++;
for(int i=; i<n; i++)
{
scanf("%lf",&r[i]);
r[i]*=r[i];
if(max1<r[i])
max1=r[i];
}
double low=,high=max1,mid;
while(high-low>eps)
{
mid=(high+low)/;
int ans=;
for(int i=; i<n; i++)
ans+=(int)(r[i]/mid);
if(ans<f)
high=mid;
else
low=mid;
}
printf("%.4lf\n",pi*mid);
}
return ;
}

poj Pie的更多相关文章

  1. poj 3311 Hie with the Pie

    floyd,旅游问题每个点都要到,可重复,最后回来,dp http://poj.org/problem?id=3311 Hie with the Pie Time Limit: 2000MS   Me ...

  2. POJ - 3122 Pie(二分)

    http://poj.org/problem?id=3122 题意 主人过生日,m个人来庆生,有n块派,m+1个人(还有主人自己)分,问每个人分到的最大体积的派是多大,PS每 个人所分的派必须是在同一 ...

  3. Hie with the Pie POJ - 3311

    Hie with the Pie POJ - 3311 The Pizazz Pizzeria prides itself in delivering pizzas to its customers ...

  4. 【POJ 3122】 Pie (二分+贪心)

    id=3122">[POJ 3122] Pie 分f个派给n+1(n个朋友和自己)个人 要求每一个人分相同面积 但不能分到超过一个派 即最多把一整个派给某个人 问能平均分的最大面积 二 ...

  5. POJ 3311 Hie with the Pie(DP状态压缩+最短路径)

    题目链接:http://poj.org/problem?id=3311 题目大意:一个送披萨的,每次送外卖不超过10个地方,给你这些地方之间的时间,求送完外卖回到店里的总时间最小. Sample In ...

  6. POJ 3122 Pie 二分枚举

    题目:http://poj.org/problem?id=3122 这个题就好多了,没有恶心的精度问题,所以1A了.. #include <stdio.h> #include <ma ...

  7. POJ 3311 Hie with the Pie(状压DP + Floyd)

    题目链接:http://poj.org/problem?id=3311 Description The Pizazz Pizzeria prides itself in delivering pizz ...

  8. [POJ 3311]Hie with the Pie——谈论TSP难题DP解决方法

    主题连接:  id=3311">http://poj.org/problem?id=3311 题目大意:有n+1个点,给出点0~n的每两个点之间的距离,求这个图上TSP问题的最小解 ...

  9. POJ 3311 Hie with the Pie floyd+状压DP

    链接:http://poj.org/problem?id=3311 题意:有N个地点和一个出发点(N<=10),给出全部地点两两之间的距离,问从出发点出发,走遍全部地点再回到出发点的最短距离是多 ...

随机推荐

  1. springMVC整合jedis+redis

    http://www.cnblogs.com/zhengbn/p/4140549.html 前两天写过 springMVC+memcached 的整合,我从这个基础上改造一下,把redis和sprin ...

  2. C++基础复习

    1.Object-C也是面向对象的语言:2.#include<iostream> //#include是一个预处理指令3.using namespace std; //std是命名空间,u ...

  3. FreeRTOS学习笔记——任务间使用队列同步数据

    1.前言 在嵌入式操作系统中队列是任务间数据交换的常用手段,队列是生产者消费者模型的重要组成部分.FreeRTOS的队列简单易用,下面结合一个具体例子说明FreeRTOS中的队列如何使用. 2.参考代 ...

  4. Android设置虚线、圆角、渐变

    有图又真相,先上图再说. 点击效果: 设置虚线: <?xml version="1.0" encoding="utf-8"?> <shape  ...

  5. Undefined symbols for architecture i386

    这个错误的发生原因一般是“XXX”这个文件(类库)虽然引入了工程中,但是由于种种原因(常见于多人开发,svn同步不规范)导致“XXX”并未被添加到project.pbxproj这个文件中. 解决方法是 ...

  6. C#泛型类的简单创建与使用

    using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Cons ...

  7. 尚未解决的intellij问题:补充措施

    2016-12-06 遇到问题 D:\software\apache-tomcat-7.0.57\bin\catalina.bat run [2016-12-06 09:54:52,342] Arti ...

  8. 解决Ubuntu 14.04 下SMPlayer的字幕乱码问题

    1.SMPlayer播放器 对于使用ubuntu系统的同学,虽然系统初始就带有vedio播放器,但是这里强烈推荐SMPlayer,直接在Ubuntu Software Center中就可以免费下载安装 ...

  9. Android 发送验证码 简易代码

    效果 Activity ;//倒计时 private Timer timer; private Handler handler = new Handler() { public void handle ...

  10. js页面加载事件

    <body onload="myfunction()" > </body> <script type="text/javascript&qu ...