poj 3122】的更多相关文章

以下三道都是经典二分,道理都差不多,代码就贴在一起了. POJ 3122    POJ 3258    POJ 3273 POJ 3122: #include<iostream> #include<cstdio> #include<cmath> #include<algorithm> using namespace std; #define PI 3.14159265359 //ÓÃ3.1415926»áWA¡£¡£¡£ ]; int main() { in…
id=3122">[POJ 3122] Pie 分f个派给n+1(n个朋友和自己)个人 要求每一个人分相同面积 但不能分到超过一个派 即最多把一整个派给某个人 问能平均分的最大面积 二分平均面积 下界0 上界最大的一份派的面积 推断条件从大派開始分(保证尽量满足)假设能分出n+1份 这样的分法就合适 下界上移 最后输出下界就可以 注意二分推断上下界用esp 否则超时 从大到小分派是一种贪心策略 太小的派能够扔掉 但从小開始分有可能第一个派就分不出这么大 不排序也可遇到小派跳过 最后推断 代…
链接:http://poj.org/problem?id=3122 Pie Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 10448   Accepted: 3694   Special Judge Description My birthday is coming up and traditionally I'm serving pie. Not just one pie, no, I have a number N…
题目:http://poj.org/problem?id=3122 这个题就好多了,没有恶心的精度问题,所以1A了.. #include <stdio.h> #include <math.h> ); ], t, n, m; int main() { scanf("%d", &t); while(t--) { , high = ; scanf("%d %d", &n, &m); ; i < n; i++) { sc…
http://poj.org/problem?id=3122 题意 主人过生日,m个人来庆生,有n块派,m+1个人(还有主人自己)分,问每个人分到的最大体积的派是多大,PS每 个人所分的派必须是在同一个派上切下来的. 分析 二分答案,每次统计当前体积下能分配的人数. #include<iostream> #include<cmath> #include<cstring> #include<queue> #include<vector> #incl…
<题目链接> 题目大意: 将n个半径不一但是高度为1的蛋糕分给 F+1个人,每个人分得蛋糕的体积应当相同,并且需要注意的是,每个人分得的整块蛋糕都只能从一个蛋糕上切下来,而不是从几个蛋糕上东拼西凑而成.现在问每人分得蛋糕的体积是多少. 解题分析:就是普通的二分答案,但是要注意一下浮点型二分的结构,与整型二分略有不同. #include <cstdio> #include <cmath> #include <algorithm> using namespace…
题目大意: 给出n个pie的直径,有f+1个人,如果给每人分的大小相同(形状可以不同),每个人可以分多少.要求是分出来的每一份必须出自同一个pie,也就是说当pie大小为3,2,1,只能分出两个大小为2的份,剩下两个要扔掉. 解题思路: 对每一个人分的大小进行二分查找,注意输出要用cout. 下面是代码: #include <stdio.h> const double pi=3.14159265359; const double esp=1e-6; int main() { int T; sc…
Pie Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 22684   Accepted: 7121   Special Judge 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…
Pie Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 13564   Accepted: 4650   Special Judge 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…
Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 17324   Accepted: 5835   Special Judge 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 vari…