Run ID:3904
提交时间:2024-07-19 01:16:10
#include <iostream> using namespace std; int main() { int c; cin >> c; while (c--) { int a, b, c; cin >> a >> b >> c; bool found = false; int x; for (x = 1000; x <= 9999; ++x) { if (x % a == 0 && (x + 1) % b == 0 && (x + 2) % c == 0) { found = true; } } if (found) { cout << x << endl; } else { cout << "Impossible" << endl; } } return 0; }