【golang】unsafe.Sizeof浅析博主也是正在学习golang,在学习过程中遇到了SizeOf的问题。我原先以为,golang中的sizeof和c的sizeof差不多,但是当我开始使用的时候,才发现了许多奇怪的问题 slice := []int{1,2,3}fmt.Println(uns ...
分类:
其他好文 时间:
2020-06-14 23:26:49
阅读次数:
80
#include <iostream> #include <cstring> using namespace std; int main() { int *p = new int[5]; for (int i = 0; i < 5; i++) { p[i] = i; } int *p2 = new ...
分类:
其他好文 时间:
2020-06-14 20:34:18
阅读次数:
68
An operator is a symbol that tells the complier to perform specifc mathematical or logical manipulations. C++ allows u to specify more than one defini ...
分类:
编程语言 时间:
2020-06-14 11:20:54
阅读次数:
58
https://ac.nowcoder.com/acm/contest/5944/A 太坑了,有空一定把它做出来 //真坑,就有一条,我加上输出调试的时候是对的,但是交的时候就变成了错的 #include <cmath> #include <cstring> #include <iostream> ...
分类:
其他好文 时间:
2020-06-13 19:43:32
阅读次数:
105
数据结构::堆排序 #include <stdio.h> void swap(int array[],int x,int y){ int key; key=array[x]; array[x]=array[y]; array[y]=key; } //从大到小排序 //void Down(int ar ...
分类:
编程语言 时间:
2020-06-13 17:13:18
阅读次数:
66
多继承语法 C++ 允许一个类继承多个类(一个子类多个父类)————> C++ 实际开发中不建议用多继承 语法:class 子类 : 继承方式 父类1,继承方式 父类2... 注意:多继承可能会引发父类中有同名成员,需要加作用域区分。 #include <iostream> using namesp ...
分类:
其他好文 时间:
2020-06-13 10:49:01
阅读次数:
53
1 #include <opencv2/opencv.hpp> 2 3 using namespace std; 4 using namespace cv; 5 6 /**将Mat类型的数据转换为uchar类型*/ 7 uchar* matToUchar(Mat img) 8 { 9 int img ...
分类:
其他好文 时间:
2020-06-12 12:52:53
阅读次数:
74
进程调度模拟算法 一、实验目的 进程调度是处理机管理的核心内容。本实验要求用高级语言编写模拟进程调度程序,以便加深理解有关进程控制快、进程队列等概念,并体会和了解优先数算法和时间片轮转算法的具体实施办法。 二、实验内容 1.设计进程控制块PCB 的结构,通常应包括如下信息: 进程名、进程优先数(或轮 ...
分类:
编程语言 时间:
2020-06-11 21:21:32
阅读次数:
56
折半查找的实现代码: #include <stdio.h> #include <stdlib.h> #define keyType int typedef struct { keyType key;//查找表中每个数据元素的值 //如果需要,还可以添加其他属性 }ElemType; typedef ...
分类:
其他好文 时间:
2020-06-11 16:44:05
阅读次数:
86
题目传送门 分析: 同色点连通挺恶心的 要求全部点连通的话就可以直接斯坦纳树了 同色点连通满足还要考虑异色点可能会共用边使答案更小 于是尝试枚举一个颜色集合的点全部连通,形成斯坦纳树 然后把所有集合拼起来,形成斯坦纳森林 之中有一种方案一定是最小的 枚举子集的子集的子集复杂度是$O(4n)$ 总复杂 ...
分类:
其他好文 时间:
2020-06-10 22:49:49
阅读次数:
62