
二分
nobleman__
加油王先生
展开
-
HDU - 1597 - find the nth digit 【简单二分】
find the nth digit假设: S1 = 1 S2 = 12 S3 = 123 S4 = 1234 ......... S9 = 123456789 S10 = 1234567891 S11 = 12345678912 ............ S18 = 123456789123456789 .................. 现在我们把所有的串连接起来 S原创 2017-10-21 13:34:40 · 668 阅读 · 0 评论 -
2017.10.30 LeetCode - 167. Two Sum II - Input array is sorted 【手写+upper_bound】
167. Two Sum II - Input array is sortedDescriptionGiven an array of integers that is already sorted in ascending order, find two numbers such that they add up to a specific target number.The function t原创 2017-10-30 20:08:29 · 458 阅读 · 0 评论 -
51NOD - 1080 两个数的平方和【简单二分】
1080 两个数的平方和给出一个整数N,将N表示为2个整数i j的平方和(i <= j),如果有多种表示,按照i的递增序输出。 例如:N = 130,130 = 3^2 + 11^2 = 7^2 + 9^2 (注:3 11同11 3算1种)Input一个数N(1 <= N <= 10^9)Output共K行:每行2个数,i j,表示N = i^2 + j^2(0 <= i <= j)。 如果无法原创 2017-11-21 21:42:27 · 426 阅读 · 0 评论 -
Wannafly挑战赛6 A 完全平方数【预处理 + 二分】
A 完全平方数题目描述多次查询[l,r]范围内的完全平方数个数 定义整数x为完全平方数当且仅当可以找到整数y使得y*y=x输入描述:第一行一个数n表示查询次数 之后n行每行两个数l,r输出描述:对于每个查询,输出一个数表示答案示例1输入5 1 3 1 4 2 4 4 4 1 1000000000输出1 2 1 1 31622备注:n <= 100000 0<= l <= r原创 2017-12-22 21:11:27 · 739 阅读 · 0 评论 -
SDUT Round #4 - 2018 新春大作战 F [4158] 雪域羚羊的来访 【二分】
雪域羚羊的来访 Time Limit: 1000 ms Memory Limit: 65536 KiB Problem Description 雪域高原的羚羊公主来青青草原做客啦。为了表示羊村的好客之情,喜羊羊带领着羚羊公主在羊村中到处游玩。这一天,在羊村的实验室里,她了解到羊村村长慢羊羊正在研制一种特别的芯片。 村长慢羊羊在芯片中设计了 n 个微型光源,每个光源操作一次就会改变其状态,...原创 2018-02-16 12:45:17 · 422 阅读 · 0 评论 -
codeforces251 A. Points on Line 【二分 + Two Pointers】
A. Points on Line time limit per test2 seconds memory limit per test256 megabytes Little Petya likes points a lot. Recently his mom has presented him n points lying on the line OX. Now Petya is won...原创 2018-02-23 22:24:18 · 435 阅读 · 0 评论 -
牛客练习赛13 B 幸运数字Ⅱ【前缀和 + 位运算 + 二分】
题目描述 定义一个数字为幸运数字当且仅当它的所有数位都是4或者7。 比如说,47、744、4都是幸运数字而5、17、467都不是。 定义next(x)为大于等于x的第一个幸运数字。给定l,r,请求出next(l) + next(l + 1) + … + next(r - 1) + next(r)。 输入描述: 两个整数l和r (1 <= l <= r <= 1000,...原创 2018-03-16 20:58:16 · 756 阅读 · 0 评论 -
LeetCode Weekly Contest 74 793. Preimage Size of Factorial Zeroes Function【二分】
793. Preimage Size of Factorial Zeroes Function Let f(x) be the number of zeroes at the end of x!. (Recall that x! = 1 * 2 * 3 * … * x, and by convention, 0! = 1.) For example, f(3) = 0 because 3! ...原创 2018-03-04 17:57:24 · 579 阅读 · 0 评论