Y.Guess the number

Y

水题,但是第一次提交还是粗心错了

#include<bits/stdc++.h>

using namespace std;

int main(){
  ios::sync_with_stdio(false);
  // freopen("in.in", "r", stdin);
  int n;
  cin >> n;
  while(n--){
    int a, b, c;
    cin >> a >> b >> c;
    bool flag = false;
    for(int i=1000; i<=9999; i++)
      if(i%a == 0 && (i+1)%b == 0 && (i+2)%c == 0){
        flag = true;
        cout << i << endl;
        break;
      }
    if(!flag)
      cout << "Impossible" << endl;
  }
  return 0;
}

猜你喜欢

转载自www.cnblogs.com/ssNiper/p/11361285.html