QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#859300 | #9668. Isoball: 2D Version | yjtac | Compile Error | / | / | C++14 | 4.5kb | 2025-01-17 17:12:00 | 2025-01-17 17:12:03 |
Judging History
This is the latest submission verdict.
- [2025-01-17 17:12:03]
- Judged
- Verdict: Compile Error
- Time: 0ms
- Memory: 0kb
- [2025-01-17 17:12:00]
- Submitted
answer
#include <iostream>
#include <math.h>
#include <numbers>
using namespace std;
long double PI = std::numbers::pi;
long double xo, yo, r, vx, vy, ix1, iy1, ix2, iy2;
struct place
{
long double px;
long double py;
};
/*
long double trans(place O, place A)
{
long double tana = (A.py - O.py) / (A.px - O.px);
if (A.px >= 0 && A.py >= 0)
{
return atan(tana);
}
else if (A.px < 0 && A.py <= 0)
{
return PI + atan(tana);
}
else if (A.px <= 0 && A.py >= 0)
{
return PI + atan(tana);
}
else if (A.px >= 0 && A.py <= 0)
{
return 2 * PI + atan(tana);
}
return atan(tana);
}*/
long double trans(place O, place A)
{
double tana = (A.py - O.py) / (A.px - O.px);
if (A.px - O.px >= 0 && A.py - O.py >= 0)
{
return atan(tana);
}
else if (A.px - O.px < 0 && A.py - O.py <= 0)
{
return PI + atan(tana);
}
else if (A.px - O.px <= 0 && A.py - O.py >= 0)
{
return PI +atan(tana);
}
else if (A.px - O.px >= 0 && A.py - O.py <= 0)
{
return 2 * PI + atan(tana);
}
return atan(tana);
}
int main()
{
long int n;
cin >> n;
while (n--)
{
cin >> xo >> yo >> r >> vx >> vy >> ix1 >> iy1 >> ix2 >> iy2;
swap(iy1, iy2);
if (abs(ix1 - ix2) < 2 * r || abs(iy1 - iy2) < 2 * r)
{
cout << "No" << endl;
continue;
}
long double L = pow(vx * vx + vy * vy, 0.5);
place leftp = {xo, yo};
place rightp = {xo + 3000000 * vx / L, yo + 3000000 * vy / L};
long double t = trans(leftp, rightp) / PI;
long double a = trans(leftp, {ix1 + r, iy1 - r}) / PI;
long double b = trans(leftp, {ix1 + r, iy2 + r}) / PI;
long double c = trans(leftp, {ix2 - r, iy1 - r}) / PI;
long double d = trans(leftp, {ix2 - r, iy2 + r}) / PI;
/*cout << t << endl;
cout << a << endl;
cout << b << endl;
cout << c << endl;
cout << d << endl;*/
if (xo < ix1 + r)
{
if (yo > iy1 - r)
{
// cout << 1 << endl;
if ((t >= 0 && t < b) || (t <= 2 && t > c))
{
cout << "No" << endl;
continue;
}
}
else if (yo < iy2 + r)
{
// cout << 2 << endl;
if ((t > a && t <= 2) || (t < d && t >= 0))
{
cout << "No" << endl;
continue;
}
}
else
{
// cout << 3 << endl;
if (t > a && t < b)
{
cout << "No" << endl;
continue;
}
}
}
else if (xo > ix2 - r)
{
if (yo > iy1 - r)
{
//cout << 4 << endl;
if ((t > d && t <= 2) || (t < a && t >= 0))
{
cout << "No" << endl;
continue;
}
}
else if (yo < iy2 + r)
{
// cout << 5 << endl;
if ((t > b && t <= 2) || (t < c && t >= 0))
{
cout << "No" << endl;
continue;
}
}
else
{
// cout << 6 << endl;
if ((t > d && t <= 2) || (t < c && t >= 0))
{
cout << "No" << endl;
continue;
}
}
}
else
{
if (yo > iy1 - r)
{
// cout << 7 << endl;
if ((t > c && t <= 2) || (t < a && t >= 0))
{
cout << "No" << endl;
//while(1);
continue;
}
}
else if (yo < iy2 + r)
{
// cout << 8 << endl;
if ((t > b && t <= 2) || (t < d && t >= 0))
{
cout << "No" << endl;
continue;
}
} /*
else
{
//cout << 9 << endl;
}*/
}
cout << "Yes" << endl;
}
return 0;
}
详细
answer.code:7:23: error: ‘std::numbers’ has not been declared 7 | long double PI = std::numbers::pi; | ^~~~~~~