上一页 1 ··· 4 5 6 7 8 9 10 11 12 ··· 22 下一页

2021年3月20日

摘要: https://www.acwing.com/problem/content/287/ 所谓树形DP,也就是关系的两边变成了树的上层和下层。 1 #include<iostream> 2 #include<cstring> 3 using namespace std; 4 const int N=6 阅读全文
posted @ 2021-03-20 18:29 greenofyu 阅读(45) 评论(0) 推荐(0)

2021年3月15日

摘要: A:水题,给定两个字符串,问能否只交换一次使得两字符串相等。 解法1:记录两字符串不相等的位置。 1 class Solution { 2 public: 3 bool areAlmostEqual(string s1, string s2) { 4 int n=s1.length(); 5 int 阅读全文
posted @ 2021-03-15 17:43 greenofyu 阅读(51) 评论(0) 推荐(0)

2021年3月14日

摘要: A:模拟题,每次进站加上应该要的时间和延迟的时间 每次等待的时候需要题给定的两个条件都满足。 注意:最后一站不需要等待,所以需要单独考虑。 1 #include<cstring> 2 #include<algorithm> 3 #include<iostream> 4 using namespace 阅读全文
posted @ 2021-03-14 22:51 greenofyu 阅读(43) 评论(0) 推荐(0)

2021年3月13日

摘要: https://www.acwing.com/problem/content/340/ 1 #include<iostream> 2 #include<vector> 3 using namespace std; 4 int get(vector<int> v,int l,int r){ 5 int 阅读全文
posted @ 2021-03-13 17:05 greenofyu 阅读(48) 评论(0) 推荐(0)

2021年3月11日

摘要: A:给了一个比较复杂的定义,但是仔细读了之后就会发现问的就是字符串s的回文长度是否大于等于k,例如abqewba的回文长度是2. 1 #include<algorithm> 2 #include<iostream> 3 using namespace std; 4 5 int main(void){ 阅读全文
posted @ 2021-03-11 10:02 greenofyu 阅读(81) 评论(0) 推荐(0)

2021年3月10日

摘要: 1、区间选点问题 https://www.acwing.com/problem/content/907/ 给定n个区间,选择尽量少的点使得每个区间都至少包含一个点,问最少的点的数量是多少。 1 #include<algorithm> 2 #include<iostream> 3 using name 阅读全文
posted @ 2021-03-10 12:00 greenofyu 阅读(68) 评论(0) 推荐(0)

2021年3月7日

摘要: A:水题。 解法1:首先确定一个全为1的串,之后如果在出现1,就返回false 1 class Solution { 2 public: 3 bool checkOnesSegment(string s) { 4 bool flag=true; 5 int n=s.size(); 6 for(int 阅读全文
posted @ 2021-03-07 23:08 greenofyu 阅读(48) 评论(0) 推荐(0)

2021年3月2日

摘要: https://www.acwing.com/problem/content/902/ 整数划分问题,给定一个正整数n,问有多少种方案使得n=x1+x2+...+xn,不考虑顺序。 解法1:利用完全背包的模型,将1~n每一个数字看成一个物品。 1 #include<iostream> 2 using 阅读全文
posted @ 2021-03-02 23:26 greenofyu 阅读(66) 评论(0) 推荐(0)

2021年2月26日

摘要: http://47.104.209.207/problem/old1065 如果超过n/2的芯片测试i为正常,那么i就是正常的。 反证:如果i不是正常的话,那么至少n/2个芯片的测试结果是错误的,与条件相违背。 不漏性证明:即证明如果少于n/2个芯片说i正常,那么i不可能是正常的。 从条件出发,至少 阅读全文
posted @ 2021-02-26 23:14 greenofyu 阅读(110) 评论(0) 推荐(0)
摘要: http://47.104.209.207/problem/old1064 字符串处理。 1 #include <iostream> 2 #include <cstring> 3 #include <algorithm> 4 5 using namespace std; 6 int main() 7 阅读全文
posted @ 2021-02-26 22:51 greenofyu 阅读(40) 评论(0) 推荐(0)
上一页 1 ··· 4 5 6 7 8 9 10 11 12 ··· 22 下一页