Run ID:152365

提交时间:2026-04-25 16:22:11

#include <iostream> using namespace std; int main() { int t; // 输入测试用例数 cin >> t; while (t--) { int a, b, c; cin >> a >> b >> c; int ans = -1; // 初始标记为没找到 // 遍历所有四位数 for (int x = 1000; x <= 9999; x++) { if (x % a == 0 && (x+1) % b == 0 && (x+2) % c == 0) { ans = x; break; // 找到就退出循环 } } if (ans != -1) { cout << ans << endl; } else { cout << "Impossible" << endl; } } return 0; }