二分三分
文章平均质量分 89
james_cil
这个作者很懒,什么都没留下…
展开
-
二分--LIGHTOJ 1088查找区间(水题)
#include #include #include using namespace std; const int maxN = 100005; int a[maxN]; int t, tt; int n, q, x, y; int Bsearch_lower_bound(int x) { int l = 0, r = n - 1, mid = 0; while (l <=原创 2014-08-05 14:45:56 · 640 阅读 · 0 评论 -
二分--1043 - Triangle Partitioning
1043 - Triangle Partitioning PDF (English) Statistics Forum Time Limit: 0.5 second(s) Memory Limit: 32 MB See the picture below. You are given AB, AC and B原创 2014-08-05 10:52:48 · 633 阅读 · 0 评论 -
二分---LIGHTOJ 1062
1062 - Crossed Ladders PDF (English) Statistics Forum Time Limit: 2 second(s) Memory Limit: 32 MB A narrow street is lined with tall buildings. An x foot long原创 2014-08-05 10:18:30 · 598 阅读 · 0 评论 -
二分---组合数,上界函数的使用
H - LIGHTOJ 1127 Time Limit:2000MS Memory Limit:32768KB 64bit IO Format:%lld & %llu Submit Status Description Given n integers and a knapsack of weight W, you have to count the num原创 2014-08-06 09:46:06 · 869 阅读 · 0 评论 -
三分--Football Goal(面积最大)
#include #include #include #include #define eps 1e-9 using namespace std; //308.812191 double getsum(double c,double a,double b){ double p=(a+b+c)/2.0; return c*c/4.0+sqrt(p*(p-a)*(p-b)*(p-c)); } d原创 2014-08-07 19:26:02 · 681 阅读 · 0 评论 -
统计一个数字在排序数组中出现的次数(二分法)
#include #include #include using namespace std; int a[500001]; int binarySearchFirstPos(int l, int r, int key) { int mid; while(l<=r){ mid =(l+r)/2; if(a[mid]<key) l=mid+1; else if(a[mid]>ke原创 2014-09-09 17:18:10 · 683 阅读 · 0 评论