用户输出
-1
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
编号 | 题目 | 状态 | 分数 | 总时间 | 内存 | 代码 / 答案文件 | 提交者 | 提交时间 |
---|---|---|---|---|---|---|---|---|
#10474 | #1070. 脸盲的zzy和jwp | Wrong Answer | 82 | 54 ms | 352 K | C++ / 621 B | lenijwp | 2019-07-04 12:08:36 |
#include <iostream>
#include <cstdio>
#define ll long long
using namespace std;
ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); }
void exgcd(ll a, ll b, ll &x, ll &y) {
if (b == 0) {
x = 1;
y = 0;
return;
}
exgcd(b, a % b, x, y);
ll t = x;
x = y;
y = t - a / b * y;
}
int main() {
// freopen("10.in","r",stdin);
// freopen("10.out","w",stdout);
ll x, y, m, n, l, a, b, c, t;
scanf("%lld%lld%lld%lld%lld", &x, &m, &y, &n, &l);
a = n - m;
b = l;
c = x - y;
t = gcd(a, b);
if (c % t != 0) {
printf("-1\n");
return 0;
}
a /= t;
b /= t;
c /= t;
exgcd(a, b, x, y);
x = ((c * x) % b + b) % b;
if (!x)
x += b;
printf("%lld\n", x);
return 0;
}
用户输出
-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
用户输出
-6424680
Special Judge 信息
Files user_out and answer differ
系统信息
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