Run ID:136097

提交时间:2025-11-09 15:17:58

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