Run ID:106870

提交时间:2025-01-16 22:06:53

#include <iostream> using namespace std; int main () { int n; cin>>n; for(int i=1;i<=n;i++) { int a,b,c; cin>>a>>b>>c; //1000<=x<=9999 int flag =0; for(int x=1000;x<=9999;x++) { if(x%a==0 && (x+1)%b==0 && (x+2)%c==0) { flag =1; cout<<x<<endl; break; } } if(flag==0) cout<<"Impossible\n"; } return 0; } /* 现在,我想让你猜一个数字x(1000<=x<=9999),它满足以下要求: (1)x % a = 0; (2)(x+1) % b = 0; (3)(x+2) % c = 0; 其中1<=a,b,c<=100。 2 44 38 49 25 56 3 Output Impossible 2575 */