摘要: 前言 在 windows_64 下利用命令:pip install pyopengl 安装 python 的 openGL 环境。 结果运行示例代码出现以下错误: OpenGL.error.NullFunctionError: Attempt to call an undefined functio 阅读全文
posted @ 2022-11-11 18:31 oumae 阅读(2232) 评论(0) 推荐(0) 编辑
摘要: kmp 概览 解决字符串匹配的问题,是一种模式匹配算法,可以在 O(n+m) 的时间复杂度内实现两个字符串的匹配。 模式匹配:给定一个主串,以及一个模式串,在主串中匹配是否存在模式串并返回具体的位置 暴力法 // s 为主串,t 为模式串 int searchSubStr(char* s, int 阅读全文
posted @ 2022-04-08 11:26 oumae 阅读(36) 评论(0) 推荐(0) 编辑
摘要: 模板 模板是C++泛型编程的一种技术 在减少代码冗余的同时仍然可以提供类型安全 能够在编译器生成对应类型的代码,实现编译器多态,增强代码复用 模板分为类模板和函数模板,声明方式相同,在类定义/函数定义之前声明模板参数列表 // 类模板 template <class T1, class T2> // 阅读全文
posted @ 2022-04-05 10:47 oumae 阅读(115) 评论(0) 推荐(0) 编辑
摘要: x |= (1<<y); // 置1 x &= ~(1<<y); // 置0 x &= (1<<y); // 取值 x ^= (1<<y); // 取反 阅读全文
posted @ 2022-03-23 23:23 oumae 阅读(88) 评论(0) 推荐(0) 编辑
摘要: 容器 string 概念 C风格字符串(以'\0'结尾)太过复杂,不适合大型程序开发,所以C++标准库定义了string类,位于头文件中 string和C风格字符串对比: char* 是一个指针,string是一个类 string封装了char *,管理这个字符串,是一个char *型的容器 str 阅读全文
posted @ 2022-03-22 21:29 oumae 阅读(19) 评论(0) 推荐(0) 编辑
摘要: int maxVal = Arrays.stream(data).flatMapToInt(Arrays::stream).max().orElse(-1); **stream(data)**获得的流是一维数组, **flatMapToInt(Arrays::stream)**将一维数组流展平为一个 阅读全文
posted @ 2022-03-21 10:45 oumae 阅读(292) 评论(0) 推荐(0) 编辑
摘要: @Test public void testBinSearch() { int[] i = {1, 3, 5, 6, 8}; int[] r1 = {bS1(i, 0), bS1(i, 1), bS1(i, 3), bS1(i, 6), bS1(i, 8), bS1(i, 9)}; System.o 阅读全文
posted @ 2021-10-30 09:42 oumae 阅读(16) 评论(0) 推荐(1) 编辑
摘要: 方式1 int mask = num; mask |= mask >> 1; mask |= mask >> 2; mask |= mask >> 4; mask |= mask >> 8; mask |= mask >> 16; 经过5次移位和异或操作,即使1在最左处,也可以覆盖整个序列 示例: 阅读全文
posted @ 2021-10-18 13:16 oumae 阅读(36) 评论(0) 推荐(1) 编辑
摘要: 1.思路: 使用pdfbox加载出页面所有的token COSString类型存储的是文字信息 由于获取的中文是乱码,无法直接匹配, 找到要去除的文字对应的乱码,获取其字节数组信息,然后据此进行匹配清除 2.添加依赖pdfbox <dependency> <groupId>org.apache.pd 阅读全文
posted @ 2021-10-05 14:49 oumae 阅读(1645) 评论(0) 推荐(1) 编辑
摘要: 判断一个整数X的奇偶性: 偶数对2取余结果为0 X % 2 == 0 ? '偶数' : '奇数' 奇数的二进制表示法最后一位一定是1,偶数一定是0 按位与&1,位运算效率更高 X & 1 == 1 ? '奇数' : '偶数' 阅读全文
posted @ 2021-04-18 22:20 oumae 阅读(204) 评论(0) 推荐(1) 编辑