用户输出
-1
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
编号 | 题目 | 状态 | 分数 | 总时间 | 内存 | 代码 / 答案文件 | 提交者 | 提交时间 |
---|---|---|---|---|---|---|---|---|
#22365 | #1070. 脸盲的zzy和jwp | Wrong Answer | 83 | 34 ms | 360 K | C++ 17 / 673 B | Leohh | 2020-02-12 19:14:00 |
#include <iostream>
#include <stdio.h>
#include <string.h>
#define int long long
using namespace std;
int x, a, y, b, p;
void exgcd(int a, int b, int &x, int &y) {
if (!b) {
x = 1, y = 0;
return;
}
exgcd(b, a % b, y, x);
y -= a / b * x;
}
int inv(int a) {
int x, y;
exgcd(a, p, x, y);
return (x % p + p) % p;
}
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
signed main() {
scanf("%lld%lld%lld%lld%lld", &x, &a, &y, &b, &p);
if (a == b || gcd(a - b, p) != 1) {
printf("-1\n");
} else {
printf("%lld\n", ((y - x) * inv(a - b) % p + p) % p);
}
}
用户输出
-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
用户输出
-1
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
用户输出
-1
系统信息
Exited with return code 0
用户输出
-1
系统信息
Exited with return code 0