摘要: 题解: 其实这题需要一些数学思路 首先我们来看正方形,只需要将方格放在一个以左上角为(0,0)的坐标系中,固定每个方格的右下角,那么很显然以这个方格延伸出来的正方形就是横竖坐标的最小值,其实这些坐标代表着他们的边线个数 然后我们来看长方形,长方形直接去求会很难,所以我们转换思路,矩形-正方形 = 长 阅读全文
posted @ 2021-01-14 15:32 loliconsk 阅读(156) 评论(0) 推荐(0)
摘要: 迭代器也是一种类型 迭代器的类型有iterator和 const_iterator 比如 vector<int>::iterator it //it 能读写vector<int>的元素 string::iterator it //it能读写string对象的字符 vector<int>::const 阅读全文
posted @ 2021-01-14 12:47 loliconsk 阅读(211) 评论(0) 推荐(0)
摘要: #include<iostream> using namespace std; //运算符递增重载 class myint { friend ostream& operator<<(ostream& cout, myint a); public: myint() { m_a = 10; } //前置 阅读全文
posted @ 2021-01-14 12:13 loliconsk 阅读(106) 评论(0) 推荐(0)
摘要: #include<iostream> using namespace std; //c++重载左移运算符 class person { friend ostream& operator<<(ostream& cout, person& p); public: person(int a, int b) 阅读全文
posted @ 2021-01-14 10:42 loliconsk 阅读(170) 评论(0) 推荐(0)
摘要: #include<iostream> using namespace std; //普通函数和模板函数的区别: //1.普通函数调用可以发生类型转换 //2.函数模板 用自动类型推导 不可以发生隐式类型转换 //3.函数模板 用显示指定类型 可以发生隐式类型转换 int add01(int a, i 阅读全文
posted @ 2021-01-14 10:05 loliconsk 阅读(168) 评论(0) 推荐(0)