poj3122 pie】的更多相关文章

方法:二分. 题目意思:要过生日了,我请大家吃pie,然后人数一共是f+1(我自己).每个人的pie不能是拼接的,而且每个人的面积是一样的,这样就用二分枚举. 范围是0-最大的那块pie. 然后用每一块去除枚举值,加到cnt上,当cnt>=f+1时候找大一点的面积, 否则找小一点的面积 pie的值要取得精确一点 , = = 另外在输出时候要是%f,如果用%lf会WA的. 上代码! #include <stdio.h> #include <math.h> #define pie…
题目链接:https://vjudge.net/problem/POJ-3122 题意:有n块饼,m+1个人,将饼均分成m+1块,求每块最大的大小. 思路:水二分,显然每块的大小与可以给多少人吃具有单调性,满足二分的性质.下限为0,上限为sum/(m+1). AC代码: #include<cstdio> #include<algorithm> #include<cmath> #include<cstdlib> using namespace std; ; )…
题目链接:http://poj.org/problem?id=3122 题意:一堆人分蛋糕,每人蛋糕大小一样,求最大能分多少,蛋糕必须是整块整块的,不能两块拼一起.然后注意输入F个人最后要分F+1份. 思路:很简单很水,但是精度处理很恶心,wa了很多发,直接二分蛋糕的半径就行了 AC代码: #include<iostream> #include<vector> #include<cstdio> #include<algorithm> #include<…
二分法的主题思路就是逐步逼近,所以这道题的思路自然一目了然,做题思路也是... 本题大意:题主过生日,它买了N块半径为R[ i ],高为1的圆柱形蛋糕,现在他要将这N块蛋糕等分给F + 1个人,为了好看分出来的每块蛋糕必须是从一整块上分割下来的,体积一样形状不限. 本题思路:那就是求那个最大的平均值啦,二分,找出最大值和最小值,二分逼近判断,就ok. 这题卡精度的一批,double二分,老套路二分100次精度异常高,什么都不用管直接AC,我一开始也wa了几次,原因时因为check函数内部实现,我…
http://poj.org/problem?id=3122 (题目链接) 题意 给出N个pie的半径和F个friend,每个friend得到的pie必须一样,求每个人能得到的pie的最大大小. solution 经典二分答案. 代码 // poj3122 #include<algorithm> #include<iostream> #include<cstdlib> #include<cstring> #include<cstdio> #inc…
Pie Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 12985   Accepted: 4490   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: 10629   Accepted: 3744   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…
"Faux Amis"节目中经常提到"原始印欧语"(PIE)——"Proto-Indo-European". 我们说过,英语,法语中的"假朋友"基本都是"同源词"(cognate),而"同源词"的"源",常常是拉丁语等古代语言.但如果再往前追溯呢?就是"原始印欧语"啦. 到8000年前的黑海沿岸地区.由于农业发展,造成人口爆炸式增长,原始印欧人被迫…
Hie with the Pie Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 3160   Accepted: 1613 Description The Pizazz Pizzeria prides itself in delivering pizzas to its customers as fast as possible. Unfortunately, due to cutbacks, they can affo…
简单的大饼游戏,掌握pygame中直线以及圆弧的画法,以及对输入的响应. import math import pygame, sys from pygame.locals import * pygame.init() screen = pygame.display.set_mode((600, 500)) pygame.display.set_caption("The Pie Game -- Press 1 2 3 4") myfont = pygame.font.Font(None…