拿走吧,记得好好想想

み柒壹ン  •  17天前


include <bits/stdc++.h>

using namespace std;

int main() {

int a, b, c;
scanf("%d%d%d", &a, &b, &c);
int x, y, z = 0;
if (a > c || b > c) {
	printf("-1");
} else {

	for (x = 1; x <= 3000; x++) {
		for (y = 1; y <= 2000; y++) {
			if (a * x + b * y == c) {
				printf("%d %d\n", x, y);

			} else {
				z++;
			}
		}
		if (z == 6000000 ) {
			printf("-1");
		}
	}
}
return 0;

}


评论:

请先登录,才能进行评论