摘要: 方法二:原地构建思路与算法 我们也可以直接对原数组 \textit{nums}nums 进行修改。 为了使得构建过程可以完整进行,我们需要让 \textit{nums}nums 中的每个元素 \textit{nums}[i]nums[i] 能够同时存储「当前值」(即 \textit{nums}[i] 阅读全文
posted @ 2021-11-26 00:06 千寻slimg 阅读(53) 评论(0) 推荐(0) 编辑
摘要: 功能相同 1 static bool sortPair(pair<int, int> a, pair<int, int> b) { 2 return a.second > b.second; 3 } 4 vector<string> findRelativeRanks(vector<int> &sc 阅读全文
posted @ 2021-11-23 21:02 千寻slimg 阅读(240) 评论(0) 推荐(0) 编辑
摘要: 1 2 long long C(int N, int M) { 3 long long sum = 1; 4 for(int i=1;i<=M; i++) { 5 sum=sum*(N-M+i)/i; 6 } 7 return sum; 8 } 阅读全文
posted @ 2021-11-21 00:09 千寻slimg 阅读(33) 评论(0) 推荐(0) 编辑
摘要: 1.顶堆 C++11中,针对顺序容器(如vector、deque、list),新标准引入了三个新成员:emplace_front、emplace和emplace_back,这些操作构造而不是拷贝元素。这些操作分别对应push_front、insert和push_back,允许我们将元素放置在容器头部 阅读全文
posted @ 2021-11-15 20:36 千寻slimg 阅读(391) 评论(0) 推荐(0) 编辑
摘要: make_heap在容器范围内,就地建堆,保证最大值在所给范围的最前面,其他值的位置不确定 pop_heap将堆顶(所给范围的最前面)元素移动到所给范围的最后,并且将新的最大值置于所给范围的最前面 push_heap当已建堆的容器范围内有新的元素插入末尾后,应当调用push_heap将该元素插入堆中 阅读全文
posted @ 2021-11-14 22:43 千寻slimg 阅读(105) 评论(0) 推荐(0) 编辑
摘要: 转载:(10条消息) C++字符串操作之字符串自然排序_zhanghm1995的博客-CSDN博客 //自然排序 bool compareNat(const std::string &a, const std::string &b) { if (a.empty()) return true; if 阅读全文
posted @ 2021-11-09 11:00 千寻slimg 阅读(153) 评论(0) 推荐(0) 编辑
摘要: 普通exe添加icon 在rc资源视图中添加ico即可 mfc更换exe图标:先删除解决方案或者资源视图中的mfc经典图标,资源视图添加新的ico setIcon更改为新的ID,编译会报错 此时删除rc.h中的IDR_MAINFRAME相关即可 阅读全文
posted @ 2021-11-08 00:37 千寻slimg 阅读(119) 评论(0) 推荐(0) 编辑
摘要: 检查多线程中的messagebox 阅读全文
posted @ 2021-08-15 12:11 千寻slimg 阅读(1160) 评论(0) 推荐(0) 编辑
摘要: 由于内容嵌入到应用程序的二进制文件中,因此无法打开资源文件进行写入,只能打开为只读 个人解决方法,qrc中移除资源文件,并且修改路径 阅读全文
posted @ 2021-03-10 22:01 千寻slimg 阅读(140) 评论(0) 推荐(0) 编辑
摘要: #include <Windows.h> #include <Tlhelp32.h> #include <stdio.h> #include <winnt.h> void terminateSuwellReader(const char* str) { HANDLE hSnapShot = Crea 阅读全文
posted @ 2021-01-31 11:43 千寻slimg 阅读(249) 评论(0) 推荐(0) 编辑