用户输出
40
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
编号 | 题目 | 状态 | 分数 | 总时间 | 内存 | 代码 / 答案文件 | 提交者 | 提交时间 |
---|---|---|---|---|---|---|---|---|
#21339 | #1070. 脸盲的zzy和jwp | Wrong Answer | 8 | 5608 ms | 246740 K | C++ 17 / 609 B | 自动化82-郭筠陶 | 2020-02-05 11:02:03 |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll x, y, a, b, l;
ll _inv[(int)2e8];
ll inverse(int p, int mod);
int main() {
cin >> x >> a >> y >> b >> l;
if (b == a) {
if (x != y)
cout << -1;
else
cout << 0;
return 0;
}
if (b < a) {
swap(a, b);
swap(x, y);
}
int p = b - a, q = (((x - y) % l) + l) % l;
cout << q * inverse(p, l);
}
ll inverse(int p, int mod) {
_inv[0] = _inv[1] = 1;
for (int i = 2; i <= p; i++) _inv[i] = ((mod - mod / i) * _inv[mod % i]) % mod;
return _inv[p];
}
用户输出
40
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
用户输出
173692137078958050
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
用户输出
116236752401682
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
用户输出
0
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
用户输出
0
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
用户输出
36376611627764516
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0