2020年4月27日

摘要: 1.虚函数与纯虚函数: A:虚函数是一种虚拟函数,主要是用来实现多态的一种函数,简单理解就是一个借口多种实现,通过虚函数,实现子类所需要的功能。 阅读全文
posted @ 2020-04-27 15:19 zb121 阅读(103) 评论(0) 推荐(0)
 

2020年4月18日

摘要: 1.树状数组:题目:UVA1428 1 #include<iostream> 2 #include<algorithm> 3 #include<cstdio> 4 #include<string> 5 #include<cstring> 6 #include<numeric> 7 #include< 阅读全文
posted @ 2020-04-18 19:57 zb121 阅读(113) 评论(0) 推荐(0)
 

2020年4月16日

摘要: POJ 3468-A Simple Problem with Integers: 题目链接 线段树经典板子题,注意当数据范围大于是1e5的时候,采用线段树求解,才可以AC。 区间更新的时候注意不要忘记加上lazy标记,减少更新的次数!!! 1 #include<iostream> 2 #includ 阅读全文
posted @ 2020-04-16 09:19 zb121 阅读(294) 评论(0) 推荐(0)
 

2020年4月10日

摘要: 300. 最长上升子序列 1 class Solution 2 { 3 public: 4 int lengthOfLIS(vector<int>& nums) 5 { 6 int n=nums.size(); 7 if(n==0)return 0; 8 if(n==1)return 1; 9 10 阅读全文
posted @ 2020-04-10 15:19 zb121 阅读(214) 评论(0) 推荐(0)
 

2020年4月9日

摘要: 1.求root(N,k) https://www.nowcoder.com/practice/9324a1458c564c4b9c4bfc3867a2aa66?tpId=40&tqId=21347&tPage=1&rp=1&ru=/ta/kaoyan&qru=/ta/kaoyan/question- 阅读全文
posted @ 2020-04-09 15:27 zb121 阅读(97) 评论(0) 推荐(0)
 

2020年3月18日

摘要: A: 1 A.A payment without change 2 #include<iostream> 3 #include<cstring> 4 #include<vector> 5 #include<algorithm> 6 using namespace std; 7 typedef lon 阅读全文
posted @ 2020-03-18 21:02 zb121 阅读(157) 评论(0) 推荐(0)
 

2020年3月15日

摘要: 1 #include<iostream> 2 using namespace std; 3 const int N=100+10; 4 const int INF=0x7fffffff; 5 int main(){ 6 int n,m; 7 while(cin>>n>>m){ 8 int dp[N] 阅读全文
posted @ 2020-03-15 02:53 zb121 阅读(1821) 评论(0) 推荐(0)
 

2020年3月9日

摘要: 5352. 生成每种字符都是奇数个的字符串 1 class Solution { 2 public: 3 string generateTheString(int n) { 4 string ans=""; 5 if(n%2==1){ 6 for(int i=0;i<n;i++){ 7 ans+=' 阅读全文
posted @ 2020-03-09 06:18 zb121 阅读(181) 评论(0) 推荐(0)
 

2020年3月8日

摘要: 1.并查集操作: 1 int father[10086]; 2 int find(int x){ 3 return father[x]=(father[x]==x?x:find(father[x]));//一般都是写这个模板,因为他快,不会超时!!! 4 } 5 void Union(int a,i 阅读全文
posted @ 2020-03-08 22:14 zb121 阅读(213) 评论(0) 推荐(0)
 

2020年3月5日

摘要: 994. 腐烂的橘子 解法一:DFS 1 int dx[4]={-1,0,1,0}; 2 int dy[4]={0,-1,0,1}; 3 class Solution { 4 public: 5 //这里需要对普通的DFS进行一定的处理,即DFS进化版本。。。 6 void dfs(vector<v 阅读全文
posted @ 2020-03-05 00:27 zb121 阅读(320) 评论(0) 推荐(0)