随笔分类 -  做题

摘要:很方便,两两相邻原点向量求差积,处以二即是面积。 #include<iostream> #include<cstring> #include<algorithm> #include<string> #include<cmath> #include<queue> #include<cstdio> us 阅读全文
posted @ 2021-01-02 18:01 TheDa 阅读(301) 评论(0) 推荐(0)
摘要:母函数可以编程解析,这样就能够很方便求出 正整数拆分问题了。 貌似还有递推公式 f(n, m) = 1; ( n = 1 or m = 1 ) f(n, n); ( n < m ) 1+ f(n, m - 1); ( n = m ) f(n - m, m) + f(n, m - 1); ( n > 阅读全文
posted @ 2021-01-02 16:56 TheDa 阅读(98) 评论(0) 推荐(0)
摘要:void bfs(int sx,int sy) { queue<node>q; vis[sx][sy]=true; q.push(node{sx,sy}); while(!q.empty()) { node pre=q.front(); q.pop(); for(int i=0;i<8;i++) { 阅读全文
posted @ 2021-01-02 16:34 TheDa 阅读(75) 评论(0) 推荐(0)
摘要:#include<iostream> #include<cstdio> #include<cstring> #include<algorithm> #include<string> #include<cmath> #include<vector> #include<queue> using name 阅读全文
posted @ 2021-01-01 19:24 TheDa 阅读(103) 评论(0) 推荐(0)
摘要:最长不重复子母的子串 TBD 感觉SB了,滑动窗口不是秒杀这种题目? 同样的还有求最短符合要求连续和问题,也是滑动窗口。http://acm.whu.edu.cn/weblearn/problem/301 阅读全文
posted @ 2021-01-01 17:11 TheDa 阅读(173) 评论(0) 推荐(0)
摘要:求树点直径两次dfs 求树上点到其他点点最远距离hdu2196 点对问题点分治+求树的重心 阅读全文
posted @ 2021-01-01 15:50 TheDa 阅读(76) 评论(0) 推荐(0)
摘要:TBD 阅读全文
posted @ 2020-12-31 11:42 TheDa 阅读(66) 评论(0) 推荐(0)
摘要:思想是排序后 bool getSumNum(int[] arr,int Sum), //arr为数组,Sum为和 { int i,j; for(i = 0, j = n-1; i < j ; ) { if(arr[i] + arr[j] == Sum) return true; else if(ar 阅读全文
posted @ 2020-12-30 19:41 TheDa 阅读(102) 评论(0) 推荐(0)
摘要:#include<unordered_map> unordered_map<int,int>mp; 阅读全文
posted @ 2020-12-30 17:30 TheDa 阅读(147) 评论(0) 推荐(0)
摘要:求<=K的所有质数 #include<cstdio> #include<queue> #include<stack> #include<algorithm> #include<cstring> #include<string> #include<vector> #include<iostream> 阅读全文
posted @ 2020-12-30 15:33 TheDa 阅读(84) 评论(0) 推荐(0)
摘要:如果碰到了按行输入,那就 string s; getline(cin,s); 如果输入当中含有转义字符的话 *char c=getchar(); if(c=='\\')cout<<111<<endl; else cout<<c<<endl;*/ 然后回车换行\n可以用getchar读取识别 还有一个 阅读全文
posted @ 2020-12-29 21:08 TheDa 阅读(76) 评论(0) 推荐(0)
摘要:https://blog.csdn.net/niiick/article/details/89153096 主要是看这一篇博客写的。 本来是想,是不是什么模拟退火,二分查找,随机搜索什么的算法。 但是最后不是,,,根据点的随机分布而得到了O(n^3)到线性时间的算法??? 就是最小圆覆盖一定是两个点 阅读全文
posted @ 2020-12-28 21:09 TheDa 阅读(103) 评论(0) 推荐(0)
摘要:for(map<ordered datatype , datatype >::iterator iter =mapname.begin();iter!=mapname.end()) cout<<mapname->first<<" "<<mapname->second. <<endl 阅读全文
posted @ 2020-12-28 17:54 TheDa 阅读(704) 评论(0) 推荐(0)