Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
136240 彭士宝 猜数字 C++ Accepted 8 MS 268 KB 563 2025-11-09 22:30:19

Tests(1/1):


Code:

#include <bits/stdc++.h> using namespace std; int find_x(int a, int b, int c) { for (int x = 1000; x < 10000; ++x) { if (x % a == 0 && (x + 1) % b == 0 && (x + 2) % c == 0) { return x; } } return -1; } int main() { int c; cin >> c; while (c--) { int a, b, c; cin >> a >> b >> c; int result = find_x(a, b, c); if (result == -1) { cout << "Impossible" << endl; } else { cout << result << endl; } } return 0; }