题目: 题解:
class Solution {
public:bool canMeasureWater(int x, int y, int z) {if (x y < z) {return false;}if (x 0 || y 0) {return z 0 || x y z;}return z % gcd(x, y) 0;}
};
一、内存泄漏
在前文中我们提到由于c没有垃圾回收器,内存泄漏问题会用智能指针解决,不妨先看一个没有智能指针防止内存泄漏的例子。
double Division(int a, int b)
{if (b 0)throw invalid_argument("除0错误");return a / b;
}void Func(…
子集切割型 递推的dp 链接
#include <bits/stdc.h>
using namespace std;
#define int long long
#define ll __int128_t
#define ar array<int, 2>
#define arr array<int, 3>
int n, m, k, inf 1LL << 61, mod 998244353;// 1e97;
const int N …
往期精选文章推荐: 深入理解 go map go 常用关键字 深入理解 Go 数组、切片、字符串 深入理解channel 深入理解 go context 深入 go interface 底层原理 深入理解 go reflect 深入理解 go unsafe
前言
在前面的文章 《深入理解 go reflect》和 《深入理解…