上一页 1 2 3 4 5 6 7 ··· 14 下一页
摘要: 这是我之前的文章: https://www.cnblogs.com/jisuanjizhishizatan/p/16149500.html 对于typeid,可以使用如下的方法输出它的名字,本质上name()方法返回的是一个string类型的字符串。 cout<<typeid(变量名).name<< 阅读全文
posted @ 2022-04-23 15:36 计算机知识杂谈 阅读(243) 评论(0) 推荐(0) 编辑
摘要: 先看题目 物品不能分隔,必须全部取走或者留下,因此称为01背包 (只有不取和取两种状态) 看第一个样例 我们需要把4个物品装入一个容量为10的背包 我们可以简化问题,从小到大入手分析 weight value 2 1 3 3 4 5 7 9 先考虑物品数量为1的情况: 把前1件物品放入容量为1的背包 阅读全文
posted @ 2022-04-19 11:50 计算机知识杂谈 阅读(308) 评论(0) 推荐(0) 编辑
摘要: #include<windows.h> #include<iostream> using namespace std; int main(){ CONSOLE_FONT_INFOEX cfi; cfi.cbSize=sizeof(cfi); HANDLE handle=GetStdHandle(ST 阅读全文
posted @ 2022-04-17 15:43 计算机知识杂谈 阅读(190) 评论(0) 推荐(0) 编辑
摘要: #include<bits/stdc++.h> #define TRUE ((_BOOL)1) #define FALSE ((_BOOL)0) struct _BOOL{ char status; _BOOL(){ status=0; } _BOOL(int x){ if(x>0)status=1 阅读全文
posted @ 2022-04-16 15:19 计算机知识杂谈 阅读(35) 评论(0) 推荐(0) 编辑
摘要: #include<bits/stdc++.h> using namespace std; struct Array_iterator{ int *ptr; void operator++(){ ptr++; } int operator*(){ return *ptr; } bool operato 阅读全文
posted @ 2022-04-16 13:21 计算机知识杂谈 阅读(32) 评论(0) 推荐(0) 编辑
摘要: 有人问:不用stdio.h能在控制台输出信息吗? 在Windows下,可以直接使用Windows API来完成,最近找到了一个函数WriteConsole,使用这个函数来在控制台输出信息。 #include<windows.h> int main(){ const char *str="Hello, 阅读全文
posted @ 2022-04-15 15:57 计算机知识杂谈 阅读(269) 评论(0) 推荐(0) 编辑
摘要: #include<bits/stdc++.h> using namespace std; int a[10]; int main(){ auto p=10; cout<<typeid(p).name(); //i } #include<bits/stdc++.h> using namespace s 阅读全文
posted @ 2022-04-15 15:48 计算机知识杂谈 阅读(98) 评论(1) 推荐(0) 编辑
摘要: 由于原书的代码中API针对作者自制的系统,这里为适应C语言标准做了修改。 #include<bits/stdc++.h> using namespace std; const int INVALID=-0x7fffffff; char *skipspace(char *p) { for (; *p 阅读全文
posted @ 2022-04-05 15:49 计算机知识杂谈 阅读(32) 评论(2) 推荐(0) 编辑
摘要: 2520是最小的能够被1到10整除的数。 最小的能够被1到20整除的数是多少? 题目意思: 求1-20之间所有数的最小公倍数。 题目分析: 1.我们知道,多个数之间的最小公倍数,可以使用分解质因数的方法进行。 例如我们要求1,2,3,4,5,6的最小公倍数,先分解质因数 然后,把每个质因子(2,3, 阅读全文
posted @ 2022-04-05 15:29 计算机知识杂谈 阅读(175) 评论(0) 推荐(0) 编辑
摘要: 最近总是听说各类说法,例如数组的速度比指针快,或是指针的速度比数组快。事实上,这两种的速度是基本一致的。 关于链表的两种实现方式,经过测试,平均运行时间都在0.17s左右 刚才测得的一些数据: 链表 指针版 0.1932 0.1551 0.1618 0.1598 0.2269 平均0.1793 链表 阅读全文
posted @ 2022-04-02 12:21 计算机知识杂谈 阅读(383) 评论(4) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 ··· 14 下一页