摘要: 动态规划中优化枚举 1235. 规划兼职工作 #include <iostream> #include <vector> #include <algorithm> using namespace std; class Solution { public: int jobScheduling(vect 阅读全文
posted @ 2025-05-14 23:07 _Sylvan 阅读(24) 评论(0) 推荐(1)
摘要: C++ 左值右值 左值(lvalue):有名字、有地址的对象,能出现在赋值号左边 右值(rvalue):没有名字、临时存在的值,只能出现在赋值号右边 如何判断 能否被赋值? 能否取地址? 类型 能 能 左值 不能 不能(大部分情况) 右值 int x = 42; &x; // 左值能取地址 &(x 阅读全文
posted @ 2025-05-14 18:42 _Sylvan 阅读(61) 评论(0) 推荐(0)
摘要: const 关键字 修饰变量 当 const 用于普通变量时,它表示该变量的值在初始化后不能被修改。 const int x = 10; x = 20; // 错误,不能修改常量变量 const int arr[3] = {1, 2, 3}; arr[0] = 4; // 错误,不能修改数组内容 修 阅读全文
posted @ 2025-05-14 18:42 _Sylvan 阅读(63) 评论(0) 推荐(0)