QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#111016 | #6563. Four Square | Tobo# | WA | 2ms | 3388kb | C++20 | 1.3kb | 2023-06-05 14:21:00 | 2023-06-05 14:21:01 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define N 2005
int x[4], y[4], sum;
void solve()
{
for (int i = 0; i < 4; i++)
cin >> x[i] >> y[i], sum += x[i] * y[i];
int a = sqrt(sum + 0.5);
if (a * a != sum)
{
cout << 0;
return;
}
for (int i = 0; i < 16; i++)
{
for (int s = 0; s < 16; s++)
{
int b = 0, c = 0, d = 0, e = 0;
for (int j = 0; j < 4; j++)
{
if (s >> j & 1)
{
if (i >> j & 1)
b += x[j], c += y[j];
else
b += y[j], c += x[j];
}
else
{
if (i >> j & 1)
d += x[j], e += y[j];
else
d += y[j], e += x[j];
}
}
if (a == b && a == c && a == d && a == e)
{
cout << 1;
return;
}
}
}
cout << 0;
}
signed main()
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int t = 1;
// cin >> t;
while (t--)
solve();
}
详细
Test #1:
score: 100
Accepted
time: 2ms
memory: 3388kb
input:
1 1 1 1 1 1 1 1
output:
1
result:
ok single line: '1'
Test #2:
score: 0
Accepted
time: 2ms
memory: 3352kb
input:
3 1 3 3 2 2 3 3
output:
0
result:
ok single line: '0'
Test #3:
score: -100
Wrong Answer
time: 1ms
memory: 3336kb
input:
2 8 2 8 2 8 2 8
output:
0
result:
wrong answer 1st lines differ - expected: '1', found: '0'