用户输出
2
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
编号 | 题目 | 状态 | 分数 | 总时间 | 内存 | 代码 / 答案文件 | 提交者 | 提交时间 |
---|---|---|---|---|---|---|---|---|
#20864 | #1070. 脸盲的zzy和jwp | Wrong Answer | 17 | 47 ms | 348 K | C++ / 748 B | wahahah | 2019-08-13 21:22:02 |
#include <bits/stdc++.h>
using namespace std;
int exgcd(int a, int b, int &x, int &y) {
if (b == 0) {
x = 1;
y = 0;
return a;
}
int d = exgcd(b, a % b, y, x);
y -= a / b * x;
return d;
}
int cal(int a, int b, int c) {
int x, y;
int gcd = exgcd(a, b, x, y);
if (c % gcd != 0)
return -1;
x = x * c / gcd;
if (b < 0)
b = -b;
int ans = x % b;
if (ans <= 0)
ans += b;
return ans;
}
int main() {
int x, a, y, b, len, res = 0;
scanf("%d %d %d %d %d", &x, &a, &y, &b, &len);
if (a == b && x != y) {
printf("-1");
return 0;
} else if (a > b) {
res = cal(a, -b, (y - x + len) % len);
printf("%d", res);
} else {
res = cal(b, -a, (x - y + len) % len);
printf("%d", res);
}
}
用户输出
2
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
用户输出
1308698
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
用户输出
-1
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
用户输出
23428482
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
用户输出
20922058
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
用户输出
38627472
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
用户输出
-1
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
用户输出
-1
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
用户输出
18651900
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
用户输出
17178295
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
用户输出
-1
系统信息
Exited with return code 0