二分与三分
文章平均质量分 84
FBI-PC
这个作者很懒,什么都没留下…
展开
-
hdu4004The Frog's Games
二分边界处理总结。。。原创 2014-05-11 15:08:24 · 1638 阅读 · 0 评论 -
hdu2289Cup
Cup Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 3550 Accepted Submission(s): 1144 Problem Description The WHU ACM Team has a原创 2014-04-20 23:03:36 · 753 阅读 · 0 评论 -
poj3685Matrix
Matrix 二分 Time Limit: 6000MS Memory Limit: 65536K Total Submissions: 4468 Accepted: 1110 Description Given a N × N matrix A, whose element in the i-th row and j-th colum原创 2014-04-11 06:59:02 · 772 阅读 · 0 评论 -
hdu2578Dating with girls(1)
Dating with girls(1) Time Limit: 6000/2000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 2745 Accepted Submission(s): 865 Problem Description Everyo原创 2014-04-08 22:08:36 · 760 阅读 · 0 评论 -
Codeforces Round #142 (Div. 2) C. Shifts
题意:给出一个N*M的矩阵,然后求移动每一行使一列全为1的最小步数。。。 思路:首先要穷举每一列J,然后对每一行进行处理,就是这一行的第J列有1的最小步数即可,然后累加所有行的最小步数。。。但是如果找每一行的策略不好,就会超时。。所以我讲一下找每一行的最小步数的二分策略。。 输入的时候就将每一行的1所在的列号存储起来。然后当枚举第J列的时候,找出第一个大于等于(lower_bound) 的位置原创 2015-04-09 19:38:01 · 509 阅读 · 0 评论 -
Leetcode_35 Search Insert Position
题目: Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order. You may assume no duplicates in the arr...原创 2018-08-12 10:36:34 · 112 阅读 · 0 评论 -
Leetcode_34 Find First and Last Position of Element in Sorted Array
题目: Given an array of integers nums sorted in ascending order, find the starting and ending position of a given target value. Your algorithm’s runtime complexity must be in the order of O(log n). I...原创 2018-08-12 10:41:13 · 215 阅读 · 0 评论 -
剑指offer&&leetcode 二分系列
题目: Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand. (i.e., [0,1,2,4,5,6,7] might become [4,5,6,7,0,1,2]). You are given a target value to search. If f...原创 2018-08-12 11:04:13 · 134 阅读 · 0 评论 -
剑指offer 数字在排序数组中出现的次数
题目: 统计一个数字在排序数组中出现的次数。 解法一:其实很简单,两行代码就搞定,就是用C++ stl里面的lower_bound和upper_bound,lower_bound是找出不小于即大于等于的第一个数的下标 upper_bound是找出大于的第一个数的下标 代码: class Solution { public: int GetNumberOfK(vector<...原创 2018-08-13 20:43:00 · 91 阅读 · 0 评论