hdoj 1969 Pie【二分】】的更多相关文章

Pie Time Limit: 5000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 6320    Accepted Submission(s): 2383 Problem Description My birthday is coming up and traditionally I'm serving pie. Not just one pie, no, I h…
Problem Description My birthday is coming up and traditionally I'm serving pie. Not just one pie, no, I have a number N of them, of various tastes and of various sizes. F of my friends are coming to my party and each of them gets a piece of pie. This…
Pie Time Limit: 5000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 16554    Accepted Submission(s): 5829   My birthday is coming up and traditionally I'm serving pie. Not just one pie, no, I have a number N of…
1.题意:一项分圆饼的任务,一堆圆饼共有N个,半径不同,厚度一样,要分给F+1个人.要求每个人分的一样多,圆饼允许切但是不允许拼接,也就是每个人拿到的最多是一个完整饼,或者一个被切掉一部分的饼,要求你算出每人能分到的饼的体积最大值.输入数据依次给出,测试数据组数T,每组数据中,给出N,F,以及N个圆饼的半径.输出最大体积的数值,精确到小数点后四位. 2.分析:一看是这种输出就知道用二分写会很高效,这里对"能分出的最大体积值"进行二分.首先,这个值有界,最大值为总体积除以总人数的值,即Σ…
题目大意:n块馅饼分给m+1个人,每个人的馅饼必须是整块的,不能拼接,求最大的. 解题思路: 1)用总饼的体积除以总人数,得到每个人最大可以得到的V.但是每个人手中不能有两片或多片拼成的一块饼. 代码如下: /* * 1969_2.cpp * * Created on: 2013年8月14日 * Author: Administrator */ #include <stdio.h> #include <math.h> #include <string.h> double…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1969 Pie Time Limit: 5000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 4513    Accepted Submission(s): 1819 Problem Description My birthday is coming up and trad…
[分析] “虽然不是求什么最大的最小值(或者反过来)什么的……但还是可以用二分的,因为之前就做过一道小数型二分题(下面等会讲) 考虑二分面积,下界L=0,上界R=∑ni=1nπ∗ri2.对于一个中值x和一张半径r的饼来说,这张饼能够分出的最多分数显然是:⌊π∗r2x⌋,所以我们只需要求出∑ni=1⌊π∗ri2x⌋,判断其与f+1的关系即可 特别要注意的一点:π的大小!,因为r≤104r≤104,所以r2≤108r2≤108,又因为题目要求精确到三位小数,所以ππ就要精确到10-11,即π=3.1…
Problem Description My birthday is coming up and traditionally I'm serving pie. Not just one pie, no, I have a number N of them, of various tastes and of various sizes. F of my friends are coming to my party and each of them gets a piece of pie. This…
Pie Time Limit: 5000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 12138    Accepted Submission(s): 4280 Problem Description My birthday is coming up and traditionally I'm serving pie. Not just one pie, no, I…
二分. #include <stdio.h> #include <math.h> ; ]; int main() { int case_n, n, f, m; double r, sum, l, mid, PI; int i; PI = acos(-); scanf("%d", &case_n); while (case_n--) { scanf("%d %d", &n, &f); sum = 0.0f; ; i<…