x*a+y*b=c;假设b杯比a杯大,那么就是往b中可以加入a杯,然后倒出b杯,就是求x和y的最大公因数,用c=n1*k*x+n2*k*y=gcd(a,b)*(n1*x+n2*y);而且c要小于a或者b的最大值.
int gcd(int a, int b) {while (b) {int t = b;b = a % b;a = t;}return std::abs(a);
}
int main() {int a, b, c;std::cin >> a >> b >> c;if (c > std::max(a, b)) {std::cout << "NO";return 0;}else {int g = gcd(a, b);if (c % g==0) {std::cout << "YES";return 0;}else {std::cout << "NO";return 0;}}return 0;
}