```
public class Solution {
public bool CanMeasureWater(int x, int y, int z)
{
if (z == 0) return true;
if (x + y < z) return false;
int gcd = Gcd(x,y);
if (gcd == 0) return false;
return z % gcd == 0;
}
public int Gcd(int x, int y)
{
if (y == 0) return x;
return Gcd(y, x % y);
}
}
```