__gcd无法调用
求解,明明调用了algorithm的库,但是执行的时候总是报错"__gcd找不到标识符"
#include<iostream>
#include"algorithm"
using namespace std;
class Solution {
public:
bool canMeasureWater(int x, int y, int z) {
//int k = __gcd(x, y);
if (x + y<z)return false;
if (x == z || y == z || x + y == z)return true;
return z%__gcd(x, y) == 0;
}
};
int main() {
Solution s;
cout << s.canMeasureWater(3, 4, 5);
}
Liiu_077
发布了1 篇原创文章 · 获赞 0 · 访问量 46
私信
关注