HBC209388FractionConstructionProblem题解

把回忆走一遍 算法基础篇 35 0
题库丰富多样,涵盖各个领域,全网最全C++题库,让您在练习中不断成长!
There are t queries. In each query, you are given two positive integers a and b . Please print a line consists of four positive integers c,d,e,f satisfying the following constraints: cdef=abfrac{c}{d} - frac{e}{f} = frac{a}{b}dcfe=ba d < b and f < b 1≤c,e≤4×10121 le c,e le 4 times 10^{12}1≤c,e≤4×1012 If there are multiple solutions, you can print anyone. If there are no solution, please print "-1 -1 -1 -1" in this line.

There are t queries. In each query, you are given two positive integers a and b (a,b≤2×106a, b le 2 times 10^6a,b≤2×106). Please print a line consists of four positive integers c,d,e,f satisfying the following constraints:     • cd−ef=abfrac{c}{d} - frac{e}{f} = frac{a}{b}dc​−fe​=ba​     • d < b and f < b     • 1≤c,e≤4×10121 le c,e le 4 times 10^{12}1≤c,e≤4×1012 If there are multiple solutions, you can print anyone. If there are no solution, please print "-1 -1 -1 -1" in this line.

HBC209388FractionConstructionProblem题解
-第1张图片-东莞河马信息技术
(图片来源网络,侵删)
成为编程大师,不再是梦想!全网最全C++题库,助您开启编程新篇章。

标签: HBC209388FractionConstructionProblem题解