Run ID:148272

提交时间:2026-02-10 21:08:05

#include <iostream> using namespace std; int main() { int c, a, b, c; bool flag; cin >> c; for (int i = 0; i < c; i++) { cin >> a >> b >> c; flag = false; for (int x = 1000; x <= 9999; x++) { if (x % a == 0 && (x + 1) % b == 0 && (x + 2) % c == 0) { cout << x << endl; flag = true; break; } } if (!flag) { cout << "Impossible" << endl; } } return 0; }