QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#112199#5673. CornholePetroTarnavskyi#Compile Error//C++171.9kb2023-06-10 16:08:252023-06-10 16:08:27

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-06-10 16:08:27]
  • 评测
  • [2023-06-10 16:08:25]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;
using LL = long long;
using ULL = unsigned long long;
using VI = vector<int>;
using VL = vector<LL>;
using PII = pair<int, int>;
using PLL = pair<LL, LL>;

#define SZ(a) (int)a.size()
#define ALL(a) a.begin(), a.end()
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define F first
#define S second
#define FOR(i, a, b) for (int i = (a); i<(b); ++i)
#define RFOR(i, b, a) for (int i = (b)-1; i>=(a); --i)
#define FILL(a, b) memset(a, b, sizeof(a))

typedef double db;

const db EPS = 1e-9;

struct Point {
	db x, y, z;
	Point() {}
	Point(db _x, db _y, db _z): x(_x), y(_y), z(_z) {}
	Point operator-(const Point& p) const {
		return {x - p.x, y - p.y, z - p.z};
	}
	Point operator*(const Point& p) const {
		return {y * p.z - z * p.y, z * p.x - x * p.z, x * p.y - y * p.x};
	}
	db d2() const {
		return x * x + y * y;
	}
	db len() const {
		return sqrt(d2());
	}
};

db findArea(const Point& p1, const Point& p2, const Point& p3) {
	return ((p3 - p1) * (p2 - p1)).len();
}

db mixedProduct(const Point& p1, const Point& p2, const Point& p3) {
	return p1.x * p2.y * p3.z + p1.y * p2.z * p3.x + p1.z * p2.x * p3.y
		- p1.z * p2.y * p3.x - p1.x * p2.z * p3.y - p1.y * p2.x * p3.z;
}

int sgn(db x) {
	return x > EPS ? 1 : x < -EPS ? -1 : 0;
}

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	vector<Point> p(6);
	for (Point& pi : p) {
		cin >> pi.x >> pi.y >> pi.z;
	}
	vector<pair<int, int>> ans;
	FOR(m, 1, 6) FOR(n, m + 1, 6) {
		vector<Point> tr1 = {p[0], p[m], p[n]}, tr2;
		FOR(i, 1, 6) {
			if (i != m && i != n) {
				tr2.push_back(p[i]);
			}
		}
		db area = findArea(tr2[1] - tr2[0], tr2[2] - tr2[0]);
		FOR(i, 0, 3) {
			const Point& q1 = tr1[i], q2 = tr[(i + 1) % 3];
			db prod1 = mixedProduct(tr2[0] - q1, tr2[1] - q1, tr2[2] - q1),
				prod2 = mixedProduct(tr2[0] - q2, tr2[1] - q2, tr2[2] - q2),
		}
	}
}

Details

answer.code: In function ‘int main()’:
answer.code:73:35: error: too few arguments to function ‘db findArea(const Point&, const Point&, const Point&)’
   73 |                 db area = findArea(tr2[1] - tr2[0], tr2[2] - tr2[0]);
      |                           ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
answer.code:44:4: note: declared here
   44 | db findArea(const Point& p1, const Point& p2, const Point& p3) {
      |    ^~~~~~~~
answer.code:75:56: error: ‘tr’ was not declared in this scope; did you mean ‘tr2’?
   75 |                         const Point& q1 = tr1[i], q2 = tr[(i + 1) % 3];
      |                                                        ^~
      |                                                        tr2
answer.code:78:17: error: expected unqualified-id before ‘}’ token
   78 |                 }
      |                 ^