随笔分类 -  二分

摘要:题目链接:https://www.luogu.com.cn/problem/P1102 方法1:二分答案 #include<bits/stdc++.h> using namespace std; int n, c, a[200005]; long long ans; int main() { cin 阅读全文
posted @ 2023-03-12 11:29 TFLSNOI 阅读(17) 评论(0) 推荐(0) 编辑
摘要:https://ac.nowcoder.com/acm/problem/213483 写法一:手写二分答案 1 //x<=ai+aj<=y; 2 //x-ai<=aj aj<=y-ai; 3 //a个数的排列方式对最后的答案不会产生影响,那么就可以对a个值排序枚举每个ai,二分处理答案 4 #inc 阅读全文
posted @ 2020-12-02 11:01 TFLSNOI 阅读(199) 评论(0) 推荐(0) 编辑
摘要:CCF2020 CSP-j2第二题 https://www.luogu.com.cn/problem/P5661 方法一:纯模拟(40分) 1 #include<bits/stdc++.h> 2 using namespace std; 3 int n, bs[100005], p[100005], 阅读全文
posted @ 2020-10-30 19:30 TFLSNOI 阅读(379) 评论(0) 推荐(0) 编辑
摘要:题目链接https://www.luogu.com.cn/problem/P1083 一、5分题解: 1 #include<bits/stdc++.h> 2 using namespace std; 3 int main() 4 { 5 cout<<0; 6 return 0; 7 } View C 阅读全文
posted @ 2020-10-23 00:05 TFLSNOI 阅读(99) 评论(0) 推荐(0) 编辑
摘要:https://www.luogu.com.cn/problem/P2678 关键词:二分套二分,时间复杂度为logL * N * logN 1 #include<bits/stdc++.h> 2 using namespace std; 3 int ll, n, m, a[50005]; 4 in 阅读全文
posted @ 2020-06-30 09:34 TFLSNOI 阅读(160) 评论(0) 推荐(0) 编辑
摘要:https://www.luogu.com.cn/problem/P2440 1 #include<bits/stdc++.h> 2 using namespace std; 3 int n, k, a[100005], max_a=-1; 4 int check(int kk){ 5 int re 阅读全文
posted @ 2020-06-29 16:04 TFLSNOI 阅读(276) 评论(0) 推荐(0) 编辑
摘要:视频学习链接:https://www.bilibili.com/video/av925583617/ 二分初学者一定要认真熟练将以下模版练习并将逻辑理解清楚 1 #include<bits/stdc++.h> 2 using namespace std; 3 int a[10]={1,3,5,7,9 阅读全文
posted @ 2020-06-29 09:06 TFLSNOI 阅读(244) 评论(0) 推荐(0) 编辑
摘要:https://www.luogu.com.cn/problem/P1678 方法一:手写二分 #include<bits/stdc++.h> using namespace std; int m, n, a[100005], b; long long ans; int bs(int p){//二分 阅读全文
posted @ 2020-06-28 18:24 TFLSNOI 阅读(305) 评论(0) 推荐(0) 编辑
摘要:https://ac.nowcoder.com/acm/problem/205055 二分答案+贪心 思路:想要二分的找到最小需要看的天数的话,其实就应该要求出在一定天数间能获得的最大知识点。贪心策略就是优先看知识点数高的书。所以我们可以先将原序列按知识点从大到小排列,再按照看书天数将书分为不同集合 阅读全文
posted @ 2020-06-28 08:57 TFLSNOI 阅读(188) 评论(0) 推荐(0) 编辑
摘要:https://www.luogu.com.cn/problem/P1024 方法一:暴力枚举 #include<bits/stdc++.h> using namespace std; double a, b, c, d, fx; int main() { cin>>a>>b>>c>>d; for( 阅读全文
posted @ 2020-06-27 15:21 TFLSNOI 阅读(240) 评论(0) 推荐(0) 编辑
摘要:https://www.luogu.com.cn/problem/P1873 #include<bits/stdc++.h> using namespace std; int n, m, a[1000005], max_h=-1; bool check(int h){ long long sum=0 阅读全文
posted @ 2020-06-24 21:15 TFLSNOI 阅读(270) 评论(0) 推荐(0) 编辑
摘要:https://www.luogu.com.cn/problem/P1102 方法一:计数(只能拿92,有一个测试点过不了) #include<bits/stdc++.h> using namespace std; int n, c, a[200005]; int b[1<<28];//注意数组最大 阅读全文
posted @ 2020-06-24 16:53 TFLSNOI 阅读(217) 评论(0) 推荐(0) 编辑
摘要:https://www.luogu.com.cn/problem/P2249 方法一:二分手写模板 #include<bits/stdc++.h> using namespace std; int n, m, a[1000005], q; int seach(int x){ int ret=-1; 阅读全文
posted @ 2020-06-24 16:33 TFLSNOI 阅读(353) 评论(0) 推荐(0) 编辑
摘要:该STL工具可以在讲快排时拓展讲解: 详解:https://blog.csdn.net/zhouyuheng2003/article/details/84964832 阅读全文
posted @ 2020-03-28 15:28 TFLSNOI 阅读(171) 评论(0) 推荐(0) 编辑
摘要:1105 第K大的数 https://www.51nod.com/Challenge/Problem.html#problemId=1105 方法1:二分套二分 方法2:双指针代替一个二分 阅读全文
posted @ 2020-02-11 20:58 TFLSNOI 阅读(160) 评论(0) 推荐(0) 编辑
摘要:题目链接: 2582 最短区间 现在给定一个整数s以及一个长度为n的整数数列a[0],a[1],a[2],a[3]....a[n-1] (全为正数), 请你求出总和不小于s的连续子序列的长度的最小值。如果解不存在,则输出0。 输入 第一行:两个整数,表示 s 与 n,其中1≤s≤10^9,1≤n≤5 阅读全文
posted @ 2020-02-10 18:29 TFLSNOI 阅读(468) 评论(0) 推荐(0) 编辑
摘要:题目来源:https://www.51nod.com/Challenge/Problem.html#problemId=2063 题目描述 输入一个整数n和n个整数,保证这n个整数已经按照从小到大进行排序。 然后输入一个整数q(q <= 100000)代表q次查询。接下来q行,每行含有一个整数m,代 阅读全文
posted @ 2020-02-09 18:34 TFLSNOI 阅读(446) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示