public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
while (n-- > 0) {
int a = in.nextInt();
int b = in.nextInt();
int[] m = exgcd(a, b);
System.out.println(m[0] + " " + m[1]);
}
}
private static int[] exgcd(int a, int b) {
if (b == 0)
return new int[]{1, 0};
int[] result = exgcd(b, a % b);
int x = result[0];
int y = result[1];
result[0] = y;
result[1] = x - (a / b) * y;
return result;
}
}
线性同余方程
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
while (n-- > 0) {
int a = in.nextInt();
int b = in.nextInt();
int m = in.nextInt();
int[] r = exgcd(a, m);
if(b % r[2] != 0) {
System.out.println("impossible");
} else {
System.out.println(r[0] * ((long) b / r[2]) % m);
}
}
}
private static int[] exgcd(int a, int m) {
if (m == 0)
return new int[]{1, 0, a};
int[] result = exgcd(m, a % m);
int x = result[0];
int y = result[1];
result[0] = y;
result[1] = x - (a / m) * y;
return result;
}
}
项目地址:
GitHub - github201014/PyQt-NativeWindow: A class of window include nativeEvent, use PySide or PyQt and Pywin32 and ctypesA class of window include nativeEvent, use PySide or PyQt and Pywin32 and ctypes - github201014/PyQt-NativeWindow…
fetch Headers is not a constructor 和 _fetch is not a function 这两个问题,本质上都是fetch在服务器上无法正常使用的问题,需要检查本地node版本与线上服务器node版本是否一致。否则在依赖安装上会产生依赖版本差异导致应用无法正常运行。 以下是wi…