Run ID:74133
提交时间:2024-05-22 22:06:30
function lcm(x, y) while y != 0 temp = y y = x % y x = temp return x * y / gcd(x, y) function find_x(a, b, c) lcm_ab = lcm(a, b) lcm_abc = lcm(lcm_ab, c) for x from lcm_abc to 9999 step lcm_abc if x % a == 0 and (x + 1) % b == 0 and (x + 2) % c == 0 return x return "Impossible" function main() c = read_input() for i from 1 to c a, b, c = read_input() print(find_x(a, b, c)) main()