其他 二分
Yishui_Blog
Try our best
展开
-
zzulioj1152: 二分搜索
1152: 二分搜索Time Limit: 1 Sec Memory Limit: 128 MBSubmit: 1493 Solved: 545SubmitStatusWeb BoardDescription在有序序列中查找某一元素x。Input首先输入一个正整数n(n接着是一个正整数m,表示有m次查找;最后是m个整数,表示m个要查找原创 2016-12-16 01:07:45 · 1875 阅读 · 1 评论 -
51Nod1001 数组中和等于K的数对 (二分
题目描述给出一个整数K和一个无序数组A,A的元素为N个互不相同的整数,找出数组A中所有和等于K的数对。例如K = 8,数组A:−1,6,5,3,4,2,9,0,8{-1,6,5,3,4,2,9,0,8},所有和等于8的数对包括(−1,9),(0,8),(2,6),(3,5)(-1,9),(0,8),(2,6),(3,5)。输入第1行:用空格隔开的2个数,K,N,K ,N,N为A数组的长度。(2<=N原创 2018-01-01 01:53:17 · 237 阅读 · 0 评论 -
HDUoj 4268 Alice and Bob ( STL二分贪心
题目描述Alice and Bob’s game never ends. Today, they introduce a new game. In this game, both of them have N different rectangular cards respectively. Alice wants to use his cards to cover Bob’s. The card原创 2018-01-23 17:37:23 · 492 阅读 · 0 评论 -
紫书例题8-3 UVa 1152 ( 二分
基础二分题。。。AC代码#include <bits/stdc++.h>using namespace std;const int MAXN = 4e3+10;int arr[MAXN], brr[MAXN], crr[MAXN], drr[MAXN];int sum[MAXN*MAXN];int main() { int T; cin >...原创 2018-04-03 16:33:57 · 158 阅读 · 0 评论 -
2018湘潭校赛 E-吃货
吃货题目描述作为一个标准的吃货,mostshy又打算去联建商业街觅食了。 混迹于商业街已久,mostshy已经知道了商业街的所有美食与其价格,而且他给每种美食都赋予了一个美味度,美味度越高表示他越喜爱这种美食。 mostshy想知道,假如带t元去商业街,只能吃一种食物,能够品味到的美食的美味度最高是多少?输入第一行是一个整数T(1 ≤ T ≤ 10),表示样例的个数。 以后...原创 2018-05-03 01:35:34 · 179 阅读 · 0 评论 -
Codeforces 720C.Cellular Network ( 二分
Cellular Network题目描述You are given n points on the straight line — the positions (x-coordinates) of the cities and m points on the same line — the positions (x-coordinates) of the cellular towers....原创 2018-05-04 00:28:53 · 197 阅读 · 0 评论 -
2018计蒜之道第一场 A.百度无人车 ( 二分
百度无人车样例样例输入146 7 8 91 3样例输出17样例输入2511 14 6 13 114 68样例输出28题意直接二分就行了, 爆LL,,,AC代码#pragma comment(linker, "/STACK:1024000000,1024000000")#include <cstdio>#include &l...原创 2018-05-13 17:14:56 · 239 阅读 · 0 评论 -
51Nod 1105 第K大的数 ( 二分
1105 第K大的数 题目描述数组A和数组B,里面都有n个整数。数组C共有n^2个整数,分别是A[0] * B[0],A[0] * B[1] ……A[1] * B[0],A[1] * B[1]……A[n - 1] * B[n - 1](数组A同数组B的组合)。求数组C中第K大的数。 例如:A:1 2 3,B:2 3 4。A与B组合成的C包括2 3 4 4 6 8 6 9 12共9个数...原创 2018-05-14 18:24:31 · 203 阅读 · 0 评论 -
51Nod 1087 1 10 100 1000 ( 二分
规律很容易可以观察到 主要是数据范围很大,需要二分查询位置即可#include &lt;bits/stdc++.h&gt;using namespace std;#define ls st&lt;&lt;1#define rs st&lt;&lt;1|1#define LL long longconst int MAXN= (int) 1e5+10;int arr[MA...原创 2018-06-28 13:36:40 · 141 阅读 · 0 评论 -
CodeForces - 1006C Three Parts of the Array ( 二分
题意:一段数字,分成三份 前一份与后一份的和必须相等, 问最大的值是多少?维护一个前缀,然后在前缀里面二分寻找相等的就好了TAT#include <bits/stdc++.h>using namespace std;#define ll long longconst int MAXN = 2e5+10;int arr[MAXN];ll sum[MAXN];...原创 2018-07-18 22:22:47 · 208 阅读 · 0 评论 -
LOJ #6249. 「CodePlus 2017 11 月赛」汀博尔 ( 二分
题目描述有n棵树,初始时每棵树的高度为Hi,第i棵树每月都会长高Ai。现在有个木料长度总量为S的订单,客户要求每块 木料的长度不能小于L,而且木料必须是整棵树(即不能为树的一部分)。现在问你最少需要等多少个月才能满足 订单。输入第一行3个用空格隔开的非负整数n,S,L,表示树的数量、订单总量和单块木料长 度限制。 第二行n个用空格隔开的非负整数,依次为H1,H2,…,Hn。 第三行n个用空原创 2017-12-22 19:00:49 · 527 阅读 · 0 评论 -
ZJCoj qwb与支教 ( 容斥+二分
qwb与支教Descriptionqwb同时也是是之江学院的志愿者,暑期要前往周边地区支教,为了提高小学生的数学水平。她把小学生排成一排,从左至右从1开始依次往上报数。玩完一轮后,他发现这个游戏太简单了。于是他选了3个不同的数x,y,z;从1依次往上开始报数,遇到x的倍数、y的倍数或z的倍数就跳过。如果x=2,y=3,z=5;第一名小学生报1,第2名得跳过2、3、4、5、6,报7;第3名得跳过8、9原创 2017-06-05 00:51:05 · 459 阅读 · 0 评论 -
Codeforces #404 (Div. 2) C. Anton and Fairy Tale (二分
C. Anton and Fairy Taletime limit per testmemory limit per test256 megabytesinputstandard inputoutputstandard outputAnton likes to listen to fairy tales, especially when Danik, Anton’s best friend, te原创 2017-03-18 14:09:48 · 706 阅读 · 0 评论 -
HDUoj 2289 Cup (二分 高精度
CupTime Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 8207 Accepted Submission(s): 2500Problem DescriptionThe WHU ACM Team has a b原创 2017-01-18 14:47:27 · 312 阅读 · 0 评论 -
HDUoj 4004 The Frog's Games ( 二分
The Frog’s Games DescriptionThe annual Games in frogs’ kingdom started again. The most famous game is the Ironfrog Triathlon. One test in the Ironfrog Triathlon is jumping. This project requires the fr原创 2017-05-01 23:05:46 · 373 阅读 · 0 评论 -
Poj 1064 Cable master(二分
Cable masterTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 40368 Accepted: 8623DescriptionInhabitants of the Wonderland have decided to hold a regional p原创 2017-01-07 01:41:11 · 413 阅读 · 0 评论 -
51Nod 1090 3个数和为0 (二分
1090 3个数和为0Description给出一个长度为N的无序数组,数组中的元素为整数,有正有负包括0,并互不相等。从中找出所有和 = 0的3个数的组合。如果没有这样的组合,输出No Solution。如果有多个,按照3个数中最小的数从小到大排序,如果最小的数相等则按照第二小的数排序。Input第1行,1个数N,N为数组的长度(0 <= N <= 1000) 第2 - N + 1行:A[i](原创 2017-04-24 00:31:18 · 271 阅读 · 0 评论 -
51Nod 1267 4个数和为0 ( 二分
1267 4个数和为0Description给出N个整数,你来判断一下是否能够选出4个数,他们的和为0,可以则输出”Yes”,否则输出”No”。Input第1行,1个数N,N为数组的长度(4 <= N <= 1000) 第2 - N + 1行:A[i](-10^9 <= A[i] <= 10^9)Output如果可以选出4个数,使得他们的和为0,则输出”Yes”,否则输出”No”。Sample I原创 2017-04-23 23:27:36 · 371 阅读 · 0 评论 -
51Nod1010 只包含因子2 3 5的数 (二分
1010 只包含因子2 3 5的数DescriptionK的因子中只包含2 3 5。满足条件的前10个数是:2,3,4,5,6,8,9,10,12,15。 所有这样的K组成了一个序列S,现在给出一个数n,求S中 >= 给定数的最小的数。 例如:n = 13,S中 >= 13的最小的数是15,所以输出15。Input第1行:一个数T,表示后面用作输入测试的数的数量。(1 <= T <= 10000原创 2017-04-25 00:29:37 · 386 阅读 · 0 评论 -
Poj 2456 Aggressive cows ( 二分+贪心
Aggressive cows DescriptionFarmer John has built a new long barn, with N (2 <= N <= 100,000) stalls. The stalls are located along a straight line at positions x1,…,xN (0 <= xi <= 1,000,000,000).His C (原创 2017-04-26 13:42:06 · 1001 阅读 · 0 评论 -
51Nod 1686 第K大区间 (尺取+二分
14原创 2018-08-04 21:50:09 · 181 阅读 · 0 评论