当前位置:网站首页>Blue bridge - maximum common divisor and minimum common multiple

Blue bridge - maximum common divisor and minimum common multiple

2022-07-05 02:14:00 uiut

 Enter two positive integers x0,y0(2<=x0<=100000,2<=y0<=100000), Find out... That satisfies the following conditions P,Q The number of 
   Conditions : 1.P,Q It's a positive integer. 
  2. requirement P,Q With x0 For the greatest common divisor , With y0 Is the minimum common multiple .
   Try to ask for : The number of all possible two positive integers that satisfy the condition .

A problem that goes the other way , It is required to get all possible results from the known common divisors and common multiples
Easy to think from 1 Start the nested loop to get the maximum common divisor and the minimum common multiple of each two numbers , And expected to judge , If it passes, output

It can be slightly optimized
The first screening
First preset two one-dimensional arrays , The first divisor used to store the common factor within the bounds , The second factor used to store the common divisor , Through cyclic comparison , Filter out the numbers that appear in both arrays at the same time

The second screening
from 2 Start the cycle , The minimum common divisor that fails to reach the reservation has been eliminated

————————————————————————————————
I don't know the specific two numbers and there are errors , Think about revising

原网站

版权声明
本文为[uiut]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202140939157701.html