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. mysql 循环插入100w

    use md5db; DROP PROCEDURE if exists myFunction; delimiter $$ CREATE PROCEDURE myFunction() BEGIN DEC ...

  2. DataGridView绑定BindingList<T>带数据排序的类

    本文章转载:http://yuyingying1986.blog.hexun.com/30905610_d.html DataGridView绑定List<T>类时候,不会自动的进行排序. ...

  3. Android 网络技术HTTP

    1.XML3种解析方式(DOM.SAX.PULL) 在网络上传输数据时最常用的格式有两种,XML 和JSON 这里首先明白什么是SAX是一个用于处理XML事件驱动的"推"模型,优点 ...

  4. Unity3d Awake、OnEnable、Start生命周期

    Unity3d,Awake.OnEnable.Start,都是游戏开始运行前,所运行的方法. GameObject的Activity为true,脚本的enable为true时,其先后顺序为:Awake ...

  5. 关于Build Active Architecture Only属性

    关于Build Active Architecture Only属性 Architecture 属性在BuildSetting里. 这个属性设置为yes,是为了debug的时候编译速度更快,它只编译当 ...

  6. MIUI6&7桌面角标开源代码简介

    MIUI6&7桌面角标开源代码简介 MIUI6&7上重新设计了桌面app图标的角标显示,基本规则如下: 一.基本介绍 1.默认的情况 当app 向通知栏发送了一条通知 (通知不带进度条 ...

  7. Codeforces 540D Bad Luck Island - 概率+记忆化搜索

    [题意] 一个岛上有三种生物A,B,C,各有多少只在输入中会告诉你,每种最多100只 A与B碰面,A会吃掉B, B与C碰面,B会吃掉C, C与A碰面,C会吃掉A...忍不住想吐槽这种环形食物链 碰面是 ...

  8. 初识Ajax技术

    Ajax:(Asynchronous JavaScript And Xml)是一种整合了JavaScript.XML.CSS等现有技术 Ajax工作流程:   纯javaScript的Ajax请求   ...

  9. java_reflect_01

    最近学习java开始接触到了框架,突然觉得java反射很重要,因此在这里做了一些总结(参考园中大苞米大神的文章) 首先我们要认识一下Class: 一.Class类有什么用? class类的实例表示ja ...

  10. 跟我学android-android常用布局介绍

    在上一章我们曾经谈到,Android平台的界面 是使用XML的方式设计的,然后在上一章我们只做了一个简单的界面,在这章,我们将介绍如何使用常用的控件设计实用的界面. Android中的视图都是继承Vi ...