提交时间:2026-05-17 20:15:43

运行 ID: 441299

#include <iostream> using namespace std; int main() { int n, x, y; cin >> n >> x >> y; // 输入三个数 bool found = false; // a 从 0 开始遍历,保证 a 最小 for (int a = 0; a * x <= n; a++) { int remain = n - a * x; if (remain % y == 0) { // 剩下的能被 y 整除 int b = remain / y; cout << a << " " << b << endl; found = true; break; } } if (!found) { cout << "Impossible" << endl; } return 0; }