用户输出
-1
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
编号 | 题目 | 状态 | 分数 | 总时间 | 内存 | 代码 / 答案文件 | 提交者 | 提交时间 |
---|---|---|---|---|---|---|---|---|
#10475 | #1070. 脸盲的zzy和jwp | Wrong Answer | 91 | 50 ms | 352 K | C++ / 873 B | lenijwp | 2019-07-04 12:09:04 |
#include <bits/stdc++.h>
using namespace std;
void exGcd(long long a, long long b, long long &d, long long &x, long long &y) {
if (b == 0) {
d = a;
x = 1;
y = 0;
} else {
exGcd(b, a % b, d, y, x);
y -= x * (a / b);
}
}
// return the min positive x
long long inverse(long long a, long long b) {
long long x, y, d;
exGcd(a, b, d, x, y);
if (d != 1)
return -1;
while (x < 0) {
x += b;
y -= a;
}
return x;
}
int main() {
long long x, a, y, b, l, ans;
cin >> x >> a >> y >> b >> l;
a = a % l;
b = b % l;
x = x % l;
y = y % l;
long long inv = inverse((a - b + l) % l, l);
if (inv == -1) {
ans = -1;
} else {
ans = (((y - x + l) % l) * (inv % l)) % l;
}
cout << ans << endl;
}
用户输出
-1
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 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