用户输出
4
系统信息
Exited with return code 0
编号 | 题目 | 状态 | 分数 | 总时间 | 内存 | 代码 / 答案文件 | 提交者 | 提交时间 |
---|---|---|---|---|---|---|---|---|
#24127 | #1070. 脸盲的zzy和jwp | Accepted | 100 | 34 ms | 364 K | C++ / 752 B | iNx | 2020-03-29 22:06:09 |
#include <iostream>
#include <cstdio>
namespace iNx {
typedef long long LL;
LL x, y;
LL ex_gcd(LL a, LL b) {
if (b == 0) {
x = 1;
y = 0;
return a;
}
LL p, q, res;
res = ex_gcd(b, a % b);
p = y;
q = x - (a / b) * y;
x = p;
y = q;
return res;
}
void work() {
LL A, B, X, Y, L;
scanf("%lld%lld%lld%lld%lld", &X, &A, &Y, &B, &L);
LL a = ((A - B) % L + L) % L;
LL b = ((Y - X) % L + L) % L;
A = ex_gcd(a, L);
if (b % A) {
printf("-1\n");
return;
}
L /= A;
x = (x % (L) + (L)) % (L);
printf("%lld\n", ((b / A) % (L)*x) % L);
}
} // namespace iNx
int main() {
iNx::work();
return 0;
}
用户输出
175111586
系统信息
Exited with return code 0
用户输出
91595156
系统信息
Exited with return code 0
用户输出
6586798
系统信息
Exited with return code 0
用户输出
83740797
系统信息
Exited with return code 0
用户输出
116043662
系统信息
Exited with return code 0
用户输出
42763932
系统信息
Exited with return code 0
用户输出
445951169
系统信息
Exited with return code 0
用户输出
169591840
系统信息
Exited with return code 0
用户输出
-1
系统信息
Exited with return code 0
用户输出
-1
系统信息
Exited with return code 0