用户输出
-6
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
编号 | 题目 | 状态 | 分数 | 总时间 | 内存 | 代码 / 答案文件 | 提交者 | 提交时间 |
---|---|---|---|---|---|---|---|---|
#9746 | #1070. 脸盲的zzy和jwp | Wrong Answer | 18 | 57 ms | 388 K | C++ / 874 B | lenijwp | 2019-07-03 15:00:26 |
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
long long Gcd(long long a, long long b) { return b == 0 ? a : Gcd(b, a % b); }
void exGcd(long long a, long long b, long long &x, long long &y) {
if (b == 0) {
x = 1;
y = 0;
return;
}
exGcd(b, a % b, x, y);
long long tmp = x;
x = y;
y = tmp - a / b * y;
}
int main() {
// freopen("8.in","r",stdin);
// freopen("8.out","w",stdout);
long long x, y, m, n, L;
long long a, c, k1, k2, r;
while (~scanf("%I64d%I64d%I64d%I64d%I64d", &x, &m, &y, &n, &L)) {
a = n - m;
c = x - y;
r = Gcd(a, L);
if (c % r) {
puts("-1");
continue;
}
a /= r;
L /= r;
c /= r;
exGcd(a, L, k1, k2);
long long ans = c * k1 - c * k1 / L * L;
if (ans < 0)
ans += L;
printf("%I64d\n", ans);
}
return 0;
}
用户输出
-6
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
用户输出
175111586
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
用户输出
91595156
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
用户输出
6586798
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
用户输出
-96590157
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
用户输出
116043662
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
用户输出
42763932
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
用户输出
445951169
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
用户输出
169591840
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
用户输出
-1
系统信息
Exited with return code 0