Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
163325 金浩宸 猜数字 C++ Accepted 7 MS 272 KB 567 2026-10-24 19:46:08

Tests(1/1):


Code:

#include <iostream> using namespace std; int main() { int T; cin >> T; while (T--) { int a, b, c; cin >> a >> b >> c; int ans = -1; // 枚举 1000~9999 for (int x = 1000; x <= 9999; x++) { if (x % a == 0 && (x + 1) % b == 0 && (x + 2) % c == 0) { ans = x; break; } } if (ans == -1) cout << "Impossible" << endl; else cout << ans << endl; } return 0; }