int main() { int n, cases=0; while(1) { cin >> n; // End of cases if(n == 0) break; // Init points.clear(); int x, y; // Read in points for (int i = 0; i < n; ++i) { cin >> x >> y; points.push_back(point(x,y)); } double convex_hull_area = area(CH(points)); // Complete the polygon, if necessary if(!(points.back() == points.front())) points.push_back(points.front()); double total_area = area(points); double percent_diff = (convex_hull_area - total_area) / convex_hull_area * 100; cout << "Tile #" << ++cases << endl; cout << "Wasted Space = " << setprecision(2) << fixed << percent_diff << " " << '%' << endl << endl; } return 0; }
int main(){ int N, n_ind, t, combs, n_morto; point input; double p_killed; cin >> t; while(t--){ cin >> n_ind; N = n_ind; combs = (N*(N-1)*(N-2))/6; positions.clear(); while(n_ind--){ cin >> input.x >> input.y; positions.push_back(input); } n_morto = 0; for(vp::iterator ii = positions.begin(); ii != positions.end(); ++ii){ for(vp::iterator jj = ii+1; jj != positions.end(); ++jj){ for(vp::iterator kk = jj+1; kk != positions.end(); ++kk){ n_morto += calc_morto(ii,jj,kk); } } } p_killed = ((double)n_morto)/(combs * ((positions.size()-3))); cout << setprecision(8) << p_killed << "\n"; } }
int main() { ios_base::sync_with_stdio(0); cin.tie(NULL); freopen("in.txt", "r", stdin); freopen("out.txt", "w", stdout); cin >> N; for (int i = 1; i <= N; i++) { point temp; cin >> temp.x >> temp.y; P.push_back(temp); } point temp; temp.x = 0; temp.y = 0; P.push_back(temp); result = convex_hull(P); cout << result.size() - 1; return 0; }
bool getInput() { //get input int np; scanf("%d ", &np); if (fabs(0 - np) < EPS) return false; double x, y; REP(i, np) { scanf("%lf %lf ", &x, &y); points.push_back(point(x, y)); }
void add_point(const Point& p) { points_.push_back(p); }