Run ID:149914

提交时间:2026-03-20 19:35:40

#include<bits/stdc++.h> using namespace std; int f(int x,int y,int z){ for(int i=1000;i<9999;i++){ if(i%x==0&&(i+1)%y==0&&(i+2)%z==0){ return i; } }return 0; } int main(){ int n,a,b,c; cin>>n; for(int i=0;i<n;i++){ cin>>a>>b>>c; if(f(a,b,c)!=0)cout<<f(a,b,c); else cout<<"Impossible"; } return 0; }