QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#230733 | #6812. Draw a triangle | realIyxiang# | WA | 21ms | 3404kb | C++14 | 727b | 2023-10-28 20:34:26 | 2023-10-28 20:34:26 |
Judging History
answer
#include <cstdio>
#include <iostream>
#include <algorithm>
using namespace std;
#define int long long
#define rep(i, l, r) for (int i = l; i <= r; ++i)
struct node { int x, y; } a, b, c;
int T;
void Exgcd (int a, int b, int &x, int &y) {
if(!b) return x = 1, y = 0, void();
Exgcd(b, a % b, y, x), y -= (a / b) * x;
}
signed main () {
ios :: sync_with_stdio(0), cin.tie(0), cout.tie(0);
cin >> T;
while (T--) {
cin >> a.x >> a.y >> b.x >> b.y;
b.x -= a.x, b.y -= a.y;
if(b.x == 0) {
c.x = 1, c.y = 0;
} else if(b.y == 0) {
c.x = 0, c.y = 1;
} else Exgcd(b.x, -b.y, c.x, c.y);
cout << c.x + a.x << ' ' << c.y + a.y << '\n';
}
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 1ms
memory: 3300kb
input:
3 1 0 1 4 0 1 0 9 0 0 2 2
output:
2 0 1 1 0 1
result:
ok T=3 (3 test cases)
Test #2:
score: -100
Wrong Answer
time: 21ms
memory: 3404kb
input:
50000 66620473 -33485015 66620223 -33485265 43307886 98029243 43307636 98028994 -88895230 -3180782 -88895480 -3181030 -90319745 20018595 -90319995 20018348 -56783257 84789686 -56783507 84789440 -81798038 90629147 -81798288 90628902 98942945 -939146 98942695 -939390 -42532151 -57203475 -42532401 -572...
output:
66620473 -33485014 43307887 98029244 -88895229 -3180781 -90319663 20018678 -56783196 84789748 -81798037 90629148 98942986 -939104 -42532047 -57203368 53500237 -30665574 27115161 46989245 -2657411 26865464 40614269 17923511 -47649884 96037732 92954368 -64534841 86508882 -51415148 -82017684 17392591 7...
result:
wrong answer wa on query #4 (test case 4)