POJ 3122-Pie(二分+精度)】的更多相关文章

题目: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…
题意:给你n个派,每个派都是高为一的圆柱体,把它等分成f份,每份的最大体积是多少. 思路: 明显的二分答案题-- 注意π的取值- 3.14159265359 这样才能AC,,, //By SiriusRen #include <cstdio> using namespace std; int n,f,cases,a[10050]; double v[10050]; bool check(double x){ int ans=0; for(int i=1;i<=n;i++)ans+=v[i…
链接: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 题意 主人过生日,m个人来庆生,有n块派,m+1个人(还有主人自己)分,问每个人分到的最大体积的派是多大,PS每 个人所分的派必须是在同一个派上切下来的. 分析 二分答案,每次统计当前体积下能分配的人数. #include<iostream> #include<cmath> #include<cstring> #include<queue> #include<vector> #incl…
题目地址:http://poj.org/problem?id=3122 二分每块饼的体积.为了保证精度,可以先二分半径的平方r*r,最后再乘以PI.要注意一点,要分的人数要包括自己,及f+1. #include<cstdio> #include<iostream> #include<algorithm> #include<cstring> #include<cmath> using namespace std; ; const double PI…
<题目链接> 题目大意: 将n个半径不一但是高度为1的蛋糕分给 F+1个人,每个人分得蛋糕的体积应当相同,并且需要注意的是,每个人分得的整块蛋糕都只能从一个蛋糕上切下来,而不是从几个蛋糕上东拼西凑而成.现在问每人分得蛋糕的体积是多少. 解题分析:就是普通的二分答案,但是要注意一下浮点型二分的结构,与整型二分略有不同. #include <cstdio> #include <cmath> #include <algorithm> using namespace…
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 should be one piece…
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…
题目大意: 给出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…
题目链接:click here~~ [题目大意]: 题意:有一些衣服,每件衣服有一定水量,有一个烘干机,每次能够烘一件衣服,每分钟能够烘掉k单位水. 每件衣服没分钟能够自己主动蒸发掉一单位水, 用烘干机烘衣服时不蒸发.问最少须要多少时间能烘干全部的衣服. [解题思路]: 题目数据较大.常规方法肯定会TE.首先能够想到二分枚举答案.枚举时间mid值,(一般二分的题目,题目叫你求什么,就二分什么就能够了) 那么相应两种方法 1:自然风干.2:吹风机吹干 若一件衣服的水量小于mid,则自然风干就可以,…