Run ID:136240

提交时间:2025-11-09 22:30:19

#include <bits/stdc++.h> using namespace std; int find_x(int a, int b, int c) { for (int x = 1000; x < 10000; ++x) { if (x % a == 0 && (x + 1) % b == 0 && (x + 2) % c == 0) { return x; } } return -1; } int main() { int c; cin >> c; while (c--) { int a, b, c; cin >> a >> b >> c; int result = find_x(a, b, c); if (result == -1) { cout << "Impossible" << endl; } else { cout << result << endl; } } return 0; }