format code

This commit is contained in:
方而静 2023-05-28 18:01:56 +08:00
parent ef0a94fbaf
commit 678ceb72bb
2 changed files with 11 additions and 4 deletions

7
2d.hpp
View File

@ -75,8 +75,11 @@ bool intersect(const Polygon<n>& a, const Polygon<m>& b) {
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
if (cross(b[j] - a[i], a[(i + 1) % n] - a[i]) * cross(b[(j + 1) % m] - a[i], a[(i + 1) % n] - a[i]) <= 0
&& cross(a[i] - b[j], b[(j + 1) % m] - b[j]) * cross(a[(i + 1) % n] - b[j], b[(j + 1) % m] - b[j])
if (cross(b[j] - a[i], a[(i + 1) % n] - a[i])
* cross(b[(j + 1) % m] - a[i], a[(i + 1) % n] - a[i])
<= 0
&& cross(a[i] - b[j], b[(j + 1) % m] - b[j])
* cross(a[(i + 1) % n] - b[j], b[(j + 1) % m] - b[j])
<= 0) {
return true;
}

View File

@ -59,7 +59,9 @@ public:
}
template<typename T>
typename std::enable_if<!std::is_floating_point<T>::value>::type expectEq(std::function<T()> func, T&& answer) noexcept {
typename std::enable_if<!std::is_floating_point<T>::value>::type expectEq(
std::function<T()> func,
T&& answer) noexcept {
auto res = runTask(func);
if (!res.has_value()) {
return onError();
@ -168,7 +170,9 @@ public:
func(t);
t.end();
std::putchar('\n');
if (t.hasFail()) return 1;
if (t.hasFail()) {
return 1;
}
}
tc.clear();
return 0;