上一页 1 ··· 15 16 17 18 19 20 21 22 23 ··· 39 下一页
摘要: 不能因为每次做一道算法题就开个随笔,故开个记录贴。坚持就是胜利! IT:https://blog.csdn.net/hackbuteer1/category_9261019.html 初期我不知道该怎么讲解,所以先以代码显示为主。。。。 题库: 每日一题 2021/2/28 单调数列:如果数组是单调 阅读全文
posted @ 2021-02-28 21:46 strive-sun 阅读(100) 评论(0) 推荐(0)
摘要: 1. char i = 1; printf("%d",i); // char字节用printf以整数型打印出来 2. int (*a[10])int a[10]是函数指针数组 #include <stdio.h> #include <Windows.h> int func1(int n) { pri 阅读全文
posted @ 2021-02-27 19:23 strive-sun 阅读(836) 评论(0) 推荐(1)
摘要: 回文:正过来和反过来的顺序是相同的就是回文。 比如:122221 #include <iostream> class Solution{ public: bool ishuiwen(int val) { if(val<0 || (val != 0) && (val %10 == 0)) { retu 阅读全文
posted @ 2021-02-26 20:45 strive-sun 阅读(196) 评论(0) 推荐(0)
摘要: 今天做case的时候遇到一个这样的问题,故记录下来。 Codeproject有类似的案例,不过是使用的MFC模板编译的。 因为我们只需要win32程序,所以就....代码如下: CodeProject: Play GIF using GDI+ 另一个是使用双缓冲实现的,我没尝试:win32双缓冲实现 阅读全文
posted @ 2021-02-26 15:17 strive-sun 阅读(880) 评论(0) 推荐(0)
摘要: #include <Windows.h> #include <stdio.h> #include <io.h> #include <fcntl.h> #pragma warning(disable:4996) bool ConvertToWideFromUTF8orACP(char* strData 阅读全文
posted @ 2021-02-26 10:47 strive-sun 阅读(166) 评论(0) 推荐(0)
摘要: 顾名思义, 就是将链表的所有结点反转。 解释见:【剑指offer】反转链表,C++实现(链表) 代码: #include <iostream> struct NodeList { int data; struct NodeList* next; NodeList() :data(0), next(N 阅读全文
posted @ 2021-02-24 10:35 strive-sun 阅读(310) 评论(0) 推荐(0)
摘要: 效率高于冒泡排序和选择排序。 初始数组:{ 27,1,11,200,31,4,58,78,23,47,9,10000}; 第一轮QuickSort的排序见, 27,1,11,200,31,4,58,78,23,47,9,10000 9,1,11,200,31,4,58,78,23,47,27,100 阅读全文
posted @ 2021-02-23 14:16 strive-sun 阅读(69) 评论(0) 推荐(0)
摘要: 很著名的一个问题。 简单描述,n个人坐成一圈,然后按k的顺序将人剔除,直到剩下最后一个人。 参考:约瑟夫问题 我的思路就是将n个人标志为0,按k的顺序剔除的人改为标志1。 代码如下: #include <iostream> int main() { int total, n,i = 0,k=0,co 阅读全文
posted @ 2021-02-21 20:13 strive-sun 阅读(109) 评论(0) 推荐(0)
摘要: 两种算法一起使用 冒泡算法的时间复杂度是n的平方,二分法是log(m+n) #include <iostream> #include <vector> #include <string> int main() { std::vector<int> nums{ 20,10,324,43,415,2,4 阅读全文
posted @ 2021-02-21 13:22 strive-sun 阅读(165) 评论(0) 推荐(0)
摘要: #include <iostream> #include <vector> #include <string> #include <unordered_set> #define max(a, b) ((a) > (b) ? (a) : (b)) struct ListNode{ int val; L 阅读全文
posted @ 2021-02-19 17:19 strive-sun 阅读(72) 评论(0) 推荐(0)
上一页 1 ··· 15 16 17 18 19 20 21 22 23 ··· 39 下一页