#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
LL ex_gcd(LL a, LL b, LL &x, LL &y)
{
if (b == 0)
{
x = 1;
y = 0;
return a;
}
LL gcd = ex_gcd(b, a % b, x, y);
LL tmp = x;
x = y;
y = tmp - a / b * y;
return gcd;
}
int main()
{
LL x, y, m, n, l;
cin >> x >> y >> m >> n >> l;
LL a = n - m, b = l, c = x - y;
LL X, Y;
LL gcd = ex_gcd(a, b, X, Y);
if (c % gcd)
{
cout << "Impossible";
return 0;
}
X = X * c / gcd;
b /= gcd;
if (b < 0)
b = -b;
X = (X % b + b) % b;
cout << X;
return 0;
}
在之前的文章中,我已经介绍了一维数组的创建和初始化和一维数组的使用,今天我们来深入了解一下一维数组在内存中的存储形式。
首先我们先用代码打出数组元素的地址。
#include <stdio.h>
int main()
{
int arr[8]{1,2,3,4,5,11,6,7,8};
int i0;
…