摘要:
扑克牌大小_牛客题霸_牛客网 (nowcoder.com) #include <iostream> #include<string> #include<algorithm> using namespace std; string op(const string& line) { if (line.f 阅读全文
扑克牌大小_牛客题霸_牛客网 (nowcoder.com) #include <iostream> #include<string> #include<algorithm> using namespace std; string op(const string& line) { if (line.f 阅读全文
posted @ 2022-10-03 16:28
lemon-Breeze
阅读(118)
评论(0)
推荐(0)
摘要:
手套_牛客题霸_牛客网 (nowcoder.com) class Gloves { public: int findMinimum(int n, vector<int> left, vector<int> right) { int sum=0; int left_sum = 0, left_min 阅读全文
手套_牛客题霸_牛客网 (nowcoder.com) class Gloves { public: int findMinimum(int n, vector<int> left, vector<int> right) { int sum=0; int left_sum = 0, left_min 阅读全文
posted @ 2022-10-03 15:33
lemon-Breeze
阅读(33)
评论(0)
推荐(0)

static_cast 相近类型之间的类型 reinterpret_cast 不相近类型之间的类型 const_cast 去掉对象const属性的转换 dynamic_cast 规范向下转换,转换是安全的 是将一个基类对象指针(或引用)转换到继承类指针,dynamic_cast会根据基类指针是否真正
RAII(Resource Acquisition Is Initialization)是一种利用对象生命周期来控制程序资源(如内 存、文件句柄、网络连接、互斥量等等)的简单技术。 在对象构造时获取资源,接着控制对资源的访问使之在对象的生命周期内始终保持有效,最后在 对象析构的时候释放资源。借此,我
异常是一种处理错误的方式,当一个函数发现自己无法处理的错误时就可以抛出异常,让函数的 直接或间接的调用者处理这个错误。 throw: 当问题出现时,程序会抛出一个异常。这是通过使用 throw 关键字来完成的。 catch: 在您想要处理问题的地方,通过异常处理程序捕获异常.catch 关键字用于捕
幸运的袋子_牛客题霸_牛客网 (nowcoder.com) 厄运的袋子 用到了深度遍历 递归回溯法 这里假设一个例子: 1 1 1 2 2 3 4 5 7 8 因为要确认是否辛运,并且保持这次不幸运,那么下一次不可能辛运,所以需要先排序 虽然排序会减少效率,但此次排序正是为了更好的效率,而排序的 假
二进制插入__牛客网 (nowcoder.com) 题意为 让m插入到n的第j位到第i位 方法1: class BinInsert { public: int binInsert(int n, int m, int j, int i) { // write code here for(int k=0
1.新增不需要赋值即可初始化 //C++98 int a = 1; int* p1 = new int[3]; Date d1(2022, 9, 26); //C++11 Date d2{ 2022,9,27 }; int* p2 = new int[3]{ 1,2,3 }; int b{ 1 };
运用lambda表达式和包装器 150. 逆波兰表达式求值 - 力扣(LeetCode) class Solution { public: int evalRPN(vector<string>& tokens) { stack<long long> s; map<string,function<lo
例题1 给40亿个不重复的无符号整数,没排过序。给一个无符号整数,如何快速判断一个数是否在 这40亿个数中。 首先肯定不能用传统的int数据存储 因为内存不够 40亿的整数大概为16G左右 思路1: 因为byte位数据小 1字节就有8个byte 那么40亿byte数据大概只有500mb左右 temp
浙公网安备 33010602011771号