二分/三分
文章平均质量分 54
GooMaple
这个作者很懒,什么都没留下…
展开
-
ZOJ 3203 Light Bulb
Light BulbTime Limit: 1 Second Memory Limit: 32768 KBCompared to wildleopard's wealthiness, his brother mildleopard is rather poor. His house is narrow and he has only one light bulb in h原创 2012-08-01 13:58:19 · 949 阅读 · 0 评论 -
HDU 3714 Error Curves
Error CurvesTime Limit: 4000/2000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 860 Accepted Submission(s): 322Problem DescriptionJosephina is a原创 2012-08-04 20:44:27 · 1924 阅读 · 1 评论 -
UVa 10487 - Closest Sums
算是简单题,先算出来所有俩数的和存起来,在用二分查找找出最接近的值 ~代码如下:#include #include #include #include #include using namespace std;int cmp(const void *a, const void *b){ return *(int*)a - *(int*)b;}int a原创 2012-08-01 13:59:29 · 708 阅读 · 0 评论 -
UVa 10341-Solve It
是个单调递减的函数,然后用二分法做,循环取估值 ~代码如下:#include#include#include#include#include#includeusing namespace std;int main(){#ifdef test freopen("sample.txt","r",stdin);#endif double p原创 2012-07-31 09:51:55 · 556 阅读 · 0 评论 -
UVa 714 - Copying Books
“最大值最小化”问题,先二分求最大值,再贪心实现按最左边区间最小的格式输出 。代码如下:#include#include#include#include#includeusing namespace std;int main(){#ifdef test freopen("in.txt", "r", stdin);#endif int a[505原创 2012-08-02 11:04:55 · 1022 阅读 · 0 评论 -
HDU 4190 - Distributing Ballot Boxes
贪心+二分,最大值最小化问题。利用投票箱b的值是一定的,将投票数进行二分,使得算出的投票箱数始终为b。代码如下:#includeint city[500001];int main(){ int n, b; while(scanf("%d%d", &n, &b)) { int Max = 0, l, r, mid; if(n=原创 2013-02-07 18:13:32 · 828 阅读 · 0 评论 -
HDU 2899-Strange fuction
凹函数求极小值,三分。代码如下:#include #include #include #include #include using namespace std;double fx(double x, double y){ return 6*pow(x,7)+8*pow(x,6)+7*pow(x,3)+5*pow(x,2)-y*x;}int main(){#i原创 2013-05-21 17:09:07 · 856 阅读 · 0 评论 -
HDU 2199-Can you solve this equation?
函数单调增,二分做。代码如下:#include #include #include #include #include using namespace std;double fx(double x){ return 8*x*x*x*x+7*x*x*x+2*x*x+3*x+6;}int main(){#ifdef test freopen("input.原创 2013-05-21 16:10:17 · 1047 阅读 · 0 评论