解题思路:
找规律
最大的最小公因数就是两数的差值
5 7 gcd=2
1 3 gcd=2
1 4 gcd=3
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
long a = scan.nextLong();
long b = scan.nextLong();
long c = Math.abs(a - b);
long k = 0;
//逆推
k = c - (a % c);
System.out.println(k);
}
}