
七七八八
各种七七八八的记录
Acnidouwo
这个作者很懒,什么都没留下…
展开
-
原码、反码、补码,计算机中负数的表示
原码 补码 反码 负数表示原创 2024-01-03 18:21:40 · 473 阅读 · 0 评论 -
Windows 下如何判断应用程序是 32 位的还是 64 位的?
判断exe是32还是64位原创 2024-01-03 17:51:33 · 5868 阅读 · 0 评论 -
最大化控制资源成本 - 华为OD统一考试(差分数组)
例如:有数组d=[1,2,3,4,5,6],对d[2]到d[4]之间的所有数加上3,变为d=[1,2,6,7,8,6],那么差分数组也就从[1,1,1,1,1,1]变成了[1,1,4,1,1,-2]。就是上面所给的原始数组的相邻元素之间的差值,我们令 d[i]=a[i+1]-a[i],一遍for循环即可将差分数组求出来。当我们希望对原数组的某一个区间[l,r]施加一个增量inc时,差分数组d对应的变化是:d[l]增加inc,d[r+1]减少inc,并且这种操作是可以叠加的。原创 2023-12-26 16:01:42 · 120 阅读 · 0 评论 -
面试必备:C++ 多态 (附:多态重载重写区别)
多态就是不同继承类的对象,对同一消息做出不同的响应,基类的指针指向或绑定到派生类的对象,使得基类指针呈现不同的表现方式。在基类的函数前加上 virtual 关键字,在派生类中重写该函数,运行时将会根据对象的实际类型来调用相应的函数。您可能想要在基类中定义虚函数,以便在派生类中重新定义该函数更好地适用于对象,但是您在基类中又不能对虚函数给出有意义的实现,这个时候就会用到纯虚函数。:多态是通过虚函数实现的,虚函数的地址保存在虚函数表中,虚函数表的地址保存在含有虚函数的类的实例对象的内存空间中。原创 2023-12-21 16:12:00 · 331 阅读 · 0 评论 -
C++ 类的析构函数和构造函数
c++类的构造函数和析构函数原创 2023-12-21 15:02:31 · 747 阅读 · 0 评论 -
面试必备:重载,重写,隐藏(重定义)三者区别
面向对象,重载,重写,隐藏三者区别原创 2023-12-21 12:11:17 · 210 阅读 · 0 评论 -
正则表达式IP地址
正则表达式学习原创 2023-12-12 17:52:11 · 300 阅读 · 0 评论 -
OpenGL环境配置
https://blog.youkuaiyun.com/AvatarForTest/article/details/79199807转载 2018-06-28 21:26:30 · 429 阅读 · 0 评论 -
poj1986 Distance Queries(LCA)
带权重 每条边 求两个点之间权重如果确定根为1,则有Dist(u,v) = Dist(1,u) + Dist(1,v) - 2*Dist( 1,LCA(u,v) )。7 6 1 6 13 E 6 3 9 E 3 5 7 S 4 1 3 N 2 4 20 W 4 7 2 S 3 1 6 1 4 2 6#include <iostream>#include <stdio.h>原创 2016-09-01 19:41:30 · 317 阅读 · 0 评论 -
poj1470Closest Common Ancestors(lca)
#include <iostream>#include <stdio.h>#include <string.h>#include <vector>using namespace std;const int n = 1100;bool root[n];bool vis[n];int pre[n];int bb[n];vector <int> e[n];vector <int> q[n原创 2016-08-31 19:31:47 · 181 阅读 · 0 评论 -
文章标题
输入一颗有根树,最后有一个询问,请输出询问中两个节点的最近公共祖先也就是LCA。#include <iostream>#include <stdio.h>#include <string.h>#include <vector>#include <algorithm>using namespace std;const int n = 10001;bool root[n]; // 判断是否为原创 2016-08-30 23:26:45 · 173 阅读 · 0 评论 -
LIS&LICS
定义d[k]:长度为k的上升子序列的最末元素,若有多个长度为k的上升子序列,则记录最小的那个最末元素。 注意d中元素是单调递增的,下面要用到这个性质。 首先len = 1,d[1] = a[1],然后对a[i]:若a[i]>d[len],那么len++,d[len] = a[i]; 否则,我们要从d[1]到d[len-1]中找到一个j,满足d[j-1]#include <stdio.h>#原创 2016-08-30 23:25:49 · 299 阅读 · 0 评论 -
拓扑排序
它是一个 DAG 图,那么如何写出它的拓扑排序呢?这里说一种比较常用的方法:从 DAG 图中选择一个 没有前驱(即入度为0)的顶点并输出。 从图中删除该顶点和所有以它为起点的有向边。 重复 1 和 2 直到当前的 DAG 图为空或当前图中不存在无前驱的顶点为止。后一种情况说明有向图中必然存在环。 于是,得到拓扑排序后的结果是 { 1, 2, 4, 3, 5 }。通常,一个有向无环图可以有一个或原创 2016-09-10 10:46:43 · 315 阅读 · 0 评论 -
hdu2594 Simpsons’ Hidden Talents (kmp)
next数组的理解,注意输出的长度不能大于s1和s2的最小长度 注意是多组数据 开始不知道让我wa的莫名其妙#include <stdio.h>#include <string.h>#include <iostream>using namespace std;char s1[120000], s2[60000], s3[60000];int f[120000];int len;vo原创 2016-04-02 22:43:50 · 325 阅读 · 0 评论 -
hdu1281 棋盘游戏(二分匹配+行列匹配)
两种写法 第一种gg了 不是太理解,以行和列建二分图 左边行右边表示列 求最大二分匹配 重要点求法就是枚举每一个点 判断最大匹配有没有改变//1#include <string.h>#include <algorithm>#include <iostream>#include <stdio.h>using namespace std;void getmap();int hungari原创 2016-05-26 19:48:15 · 283 阅读 · 0 评论 -
hdu1179Ollivanders: Makers of Fine Wands since 382 BC.(二分匹配)
Ollivanders: Makers of Fine Wands since 382 BC.Problem Description In Diagon Alley ,there is only one Wand-seller,peeling gold letters over the door read Ollivanders: Makers of Fine Wands since 382 BC原创 2016-05-27 01:03:31 · 241 阅读 · 0 评论 -
hdu1498 50 years, 50 colors(最小顶点覆盖)
50 years, 50 colorsProblem Description On Octorber 21st, HDU 50-year-celebration, 50-color balloons floating around the campus, it’s so nice, isn’t it? To celebrate this meaningful day, the ACM team o原创 2016-05-27 19:09:08 · 228 阅读 · 0 评论 -
hdu2648 shopping(map应用)
includeincludeincludeincludeincludeincludeincludeusing namespace std;int main() { int n,i; while(scanf(“%d”,&n)!=EOF) { string temp; map原创 2016-05-31 18:02:08 · 393 阅读 · 0 评论 -
hdu1507(二分匹配)
大意是求最多能有多少组白块,相邻的两块为一组,所以这道题目的两个集合可以设定为横纵坐标之和为奇数的集合和横纵坐标之和为偶数的集合,然后建图,一个点只能与之上下左右的点相连,所以只需考虑这四个方向就可以了。“`#include <stdio.h>#include <string.h>#include <iostream>#include <algorithm>#include <vector>原创 2016-06-01 21:47:21 · 216 阅读 · 0 评论 -
快速幂&矩阵快速幂
#include <iostream>#include <string.h>#include <stdio.h>/*int pow(int a, int b){ long long ans = 1, base = a; while(b != 0) { if(b & 1) { ans *= base;原创 2016-08-28 11:25:14 · 390 阅读 · 0 评论 -
LCS
#include <stdio.h>#include <string.h>#include <iostream>using namespace std;int n, m, k = 0;int a1[120], a2[120];int dp[110][110];int LCS(){ for(int i = 0; i < n; i++) { for(int原创 2016-08-29 11:11:30 · 387 阅读 · 0 评论 -
spfa最短路
int n;//表示n个点,从1到n标号int s, t;//s为源点,t为终点int d[N];//d[i]表示源点s到i的最短路int p[N];//记录路径(记录前驱)queue <int> q; ////一个队列bool vis[N];//vis[i] = 1表示点i在队列中int spfa_bfs(int s){ queue<int> q; memset(d,原创 2016-09-10 10:19:28 · 352 阅读 · 0 评论 -
poj3080 kmp
1.直接用string#include <stdio.h>#include <string.h>#include <iostream>using namespace std;string str[15];int main(){ ios::sync_with_stdio(0); int T, i, j, n, k; cin >> T; string tmp,原创 2016-04-02 20:27:59 · 317 阅读 · 0 评论