PieTime Limit: 5000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 16105 Accepted Submission(s): 5669 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 should be one piece of one pie, not several small pieces since that looks messy. This piece can be one whole pie though. Input One line with a positive integer: the number of test cases. Then for each test case: Output For each test case, output one line with the largest possible volume V such that me and my friends can all get a pie piece of size V. The answer should be given as a floating point number with an absolute error of at most 10^(-3). Sample Input 3 Sample Output 25.1327 思路: 易知每个人分得的蛋糕最小为0,最大为最大的那个蛋糕,于是二分,对于每次的蛋糕大小,我们求出蛋糕能够分得的人数x,如果x >m则说明蛋糕分得小了,如果x<m说明蛋糕分得大了; 代码: #include<cstdio> |
hdu1969 Pie 二分
猜你喜欢
转载自blog.csdn.net/cloudy_happy/article/details/81265497
今日推荐
周排行