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. hibernate4.3.8与spring mvc结合遇到的问题

    2703 [2015-01-21 16:47:42 ] - [ip=, ref=, ua=, sid=] WARN o.h.e.jdbc.spi.SqlExceptionHelper - SQL Er ...

  2. @property的特性

    @property还有一些关键字,它们都是有特殊作用的,比如上述代码中的nonatomic,strong: 1 2 @property(nonatomic,strong) NSString *carN ...

  3. 基于redis 内存数据库简单使用

    在ecplise中使用内存数据的客端户,前提要准备要下载两个jar包 commons-pool2-2.0.jar jedis-2.4.2.jar 前提准备做好了,那我们就开启redis的服务,打开一个 ...

  4. LINUX 内核与 systemtap +GO 专家博客 一个[ 系统软件工程师] 的随手涂鸦

    http://nanxiao.me/category/%E3%80%8Anix-hacking%E3%80%8B%E6%9D%82%E5%BF%97/     月刊 https://github.co ...

  5. android中的数据库操作(转)

    android中的数据库操作 android中的应用开发很难避免不去使用数据库,这次就和大家聊聊android中的数据库操作. 一.android内的数据库的基础知识介绍 1.用了什么数据库   an ...

  6. Codeforces 526D - Om Nom and Necklace 【KMP】

    ZeptoLab Code Rush 2015 D. Om Nom and Necklace [题意] 给出一个字符串s,判断其各个前缀是否是 ABABA…ABA的形式(A和B都可以为空,且A有Q+1 ...

  7. js的定位实现和ip查询

    sina的api var GetLocationFromSina = function (successFunc, errorFunc) { $.getScript('http://int.dpool ...

  8. 简易google地图api调用

    代码如下: <!DOCTYPE html> <html> <head> <meta name="viewport" content=&qu ...

  9. xcode升级插件失效修复

    每次xcode升级以后,插件都会失效.可以通过一行命令解决这个问题. 摘自传人的博客 find ~/Library/Application\ Support/Developer/Shared/Xcod ...

  10. C#设置IP地址,启用禁用适配器

    界面效果图如下: 报表界面 说下关键代码 需要开启 Windows Management Instrumentation服务(默认已经开启),在程序中需要增加 Management引用. 主要有Net ...