1、题目
https://leetcode-cn.com/problems/water-and-jug-problem/
2、题意
题解1:最大公约数
class Solution {
public:
bool canMeasureWater(int x, int y, int z) {
return z==0||(x+y>=z&&z%__gcd(x,y)==0);
}
};
https://leetcode-cn.com/problems/water-and-jug-problem/
题解1:最大公约数
class Solution {
public:
bool canMeasureWater(int x, int y, int z) {
return z==0||(x+y>=z&&z%__gcd(x,y)==0);
}
};