上一页 1 2 3 4 5 6 7 8 9 ··· 22 下一页

2021年7月5日

摘要: A:水题。 https://www.acwing.com/problem/content/3729/ 1 #include<iostream> 2 using namespace std; 3 const int N=110; 4 int w[N]; 5 int main() 6 { 7 int T 阅读全文
posted @ 2021-07-05 22:06 greenofyu 阅读(45) 评论(0) 推荐(0)

2021年7月1日

摘要: https://www.acwing.com/problem/content/897/ 1 #include <iostream> 2 #include <cstring> 3 #include <algorithm> 4 using namespace std; 5 const int N=101 阅读全文
posted @ 2021-07-01 23:49 greenofyu 阅读(59) 评论(0) 推荐(0)

2021年6月26日

摘要: https://www.acwing.com/problem/content/900/ 注意处理边界即可。 1 #include <iostream> 2 #include <cstring> 3 #include <algorithm> 4 using namespace std; 5 const 阅读全文
posted @ 2021-06-26 10:28 greenofyu 阅读(57) 评论(0) 推荐(0)

2021年6月3日

摘要: 线段树的基本思想是分治。 此处的是简单线段树,即只支持单点修改,区间查询,不涉及懒标记。 树的每一个节点维护一个区间 [ l , r ] 的值,其子节点的区间的并集等于这个区间的值,左儿子维护[l , mid] ,右儿子维护[ mid+1 , r ]。 树的高度为log(n),所以更新操作的时间复杂 阅读全文
posted @ 2021-06-03 19:44 greenofyu 阅读(50) 评论(0) 推荐(0)

2021年6月2日

摘要: A:水题。 https://leetcode-cn.com/problems/check-if-word-equals-summation-of-two-words/ 1 class Solution { 2 public: 3 int tans(string s){ 4 int res=0; 5 阅读全文
posted @ 2021-06-02 19:35 greenofyu 阅读(48) 评论(0) 推荐(0)

2021年6月1日

摘要: A:水题。 给定两个数组,找到从这俩数组中各找一数,使得和不在任何一个数组中。 因为数组中的数都是正整数,最大的俩数相加必然不在这俩数组之中。 1 #include <iostream> 2 #include <cstring> 3 #include <algorithm> 4 using name 阅读全文
posted @ 2021-06-01 13:59 greenofyu 阅读(53) 评论(0) 推荐(0)

2021年5月28日

摘要: 证明参考:https://zhuanlan.zhihu.com/p/297885717(抄的) 树状数组支持的操作:单点修改,区间查询(仅限于支持减法的操作,不支持的例子:max) 树状数组定义:定义C[ i ] 表示的是A [ i - lowbit(i) ] + 1 ~~ A[ i ] 之间的数据 阅读全文
posted @ 2021-05-28 09:23 greenofyu 阅读(73) 评论(0) 推荐(0)

2021年5月24日

摘要: A:水题,给定01串,问连续的0更长还是连续的1更长。 直接遍历即可。 1 class Solution { 2 public: 3 bool checkZeroOnes(string s) { 4 int res1=0,res0=0; 5 int cnt1=0,cnt0=0; 6 for(int 阅读全文
posted @ 2021-05-24 21:39 greenofyu 阅读(48) 评论(0) 推荐(0)

2021年5月23日

摘要: A:水题,找到不小于n的能够被4整除的最小的数。 假设n不能被4整除,那么n+1,n+2,n+3之中一定存在一个数能够被4整除。所以直接枚举即可。 1 #include <iostream> 2 #include <cstring> 3 #include <algorithm> 4 using na 阅读全文
posted @ 2021-05-23 15:36 greenofyu 阅读(49) 评论(0) 推荐(0)

2021年5月20日

摘要: https://www.acwing.com/problem/content/3513/ 其中一个串不重复是公共子序列问题转换为上升子序列问题的一个充要条件。 #include <iostream> #include <cstring> #include <algorithm> using name 阅读全文
posted @ 2021-05-20 20:42 greenofyu 阅读(58) 评论(0) 推荐(0)
上一页 1 2 3 4 5 6 7 8 9 ··· 22 下一页