会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
黎曼猜想
博客园
首页
新随笔
联系
订阅
管理
上一页
1
2
3
下一页
2020年10月21日
c++ 自定pair等数据类型的hash以及相等判定来满足unordered_set、unordered_map的需要
摘要: 第一种: 1 #include <iostream> 2 #include <unordered_set> 3 #include <utility> 4 #include <vector> 5 6 using namespace std; 7 8 using KEY = pair<int,int>;
阅读全文
posted @ 2020-10-21 10:20 黎曼猜想
阅读(1382)
评论(0)
推荐(1)
2020年10月20日
c++ const、inline等几种成员函数修饰词的书写位置
摘要: inline:声明和定义处(类外)都可以写,建议只写在类外定义处,实现写在inl.h里include在.h文件里而不是写在.cpp或.cc; const:类内声明和类外定义都要写; virtual:只能写在类内声明处; override/final:只能写在类内声明处; explicit:只能写在类
阅读全文
posted @ 2020-10-20 11:27 黎曼猜想
阅读(211)
评论(0)
推荐(0)
2020年10月12日
c++标准异常使用和<<运算符重载示例
摘要: 1 #include <iostream> 2 #include <stdexcept> 3 4 using namespace std; 5 6 7 class Data 8 { 9 public: 10 Data(int a,int b):y(a),m(b) 11 { 12 if(b < 1 |
阅读全文
posted @ 2020-10-12 21:18 黎曼猜想
阅读(135)
评论(0)
推荐(0)
2020年10月9日
c语言安全输入字符数组
摘要: 1 #include <stdio.h> 2 3 int main() 4 { 5 const int max_name = 20; // 字符数组最大长度 6 char name[max_name]; 7 8 char fmt[10]; 9 sprintf(fmt,"%%%ds",max_name
阅读全文
posted @ 2020-10-09 20:59 黎曼猜想
阅读(318)
评论(0)
推荐(0)
2020年10月2日
C++的max
摘要: 使用 max 比较多个数字(在c++20生效): 1 #include <iostream> 2 3 using namespace std; 4 5 int main() 6 { 7 int a = 0,b = 9,c = 9,d = 7; 8 cout << max( {a,b,c,d} ) <
阅读全文
posted @ 2020-10-02 21:39 黎曼猜想
阅读(1129)
评论(0)
推荐(0)
2020年9月4日
一种传已知数组长度的数组指针的方法
摘要: #include <iostream> using namespace std; void f(int (&a)[3] ) // why? { cout << sizeof(a)/sizeof(int) << endl; for(auto i:a) { cout << i << endl; } fo
阅读全文
posted @ 2020-09-04 09:36 黎曼猜想
阅读(139)
评论(0)
推荐(0)
2020年7月18日
C++ unique去重的常用用法
摘要: 1 #include <iostream> 2 #include <vector> 3 #include <algorithm> 4 5 using namespace std; 6 7 int main() 8 { 9 vector<int> nums{1,3,4,6,5,3,2,4,7,5};
阅读全文
posted @ 2020-07-18 23:14 黎曼猜想
阅读(641)
评论(0)
推荐(0)
2020年7月5日
回溯法和动态规划的一般模板
摘要: 1.回溯法 回溯法的基础题目类型就是子集树和排列树,掌握最基础的模板,那么其它的题目都可以在此上变形得到,子集树即如下图所示: 同一个元素不能被选入多次,子集树的算法模板为 1 void Backtrack(int t) { //t 表示当前是树的第t层,即对集合 S 中的第 t 个元素进行判断 2
阅读全文
posted @ 2020-07-05 18:26 黎曼猜想
阅读(779)
评论(0)
推荐(0)
2020年6月26日
用getline分割字符串
摘要: 使用getline和stringstream分割字符串: 1 #include <iostream> 2 #include <string> 3 #include <sstream> 4 #include <vector> 5 6 using namespace std; 7 8 int main(
阅读全文
posted @ 2020-06-26 11:56 黎曼猜想
阅读(1022)
评论(0)
推荐(0)
2020年6月7日
strtok函数用法
摘要: 1 #include <iostream> 2 #include <cstring> 3 #include <string> 4 #include <vector> 5 6 using namespace std; 7 8 int main() 9 { 10 vector<int> v; 11 st
阅读全文
posted @ 2020-06-07 18:04 黎曼猜想
阅读(363)
评论(0)
推荐(0)
上一页
1
2
3
下一页
公告