枚举两点,确定一条线段,计算每条线段的中点坐标. 按线段中点坐标排个序.找出每一种坐标有几个. 假设第x种坐标有y个,那么这些线段可以组成y*(y-1)/2种平行四边形. 累加即可. #include<cstdio> #include<cstring> #include<cmath> #include<vector> #include<algorithm> using namespace std; +; long long x[maxn],y[m…
题意:询问多少个矩形. 统计横纵坐标差,放进vector中 #include<cstdio> #include<cstring> #include<iostream> #include<queue> #include<stack> #include<bits/stdc++.h> using namespace std; #define LL long long ],y[]; vector<pair<int,int>…
pro:给定N个点,问多少个点组成了平行四边形.保证没有三点共线. sol:由于没有三点贡献,所以我们枚举对角线,对角线的中点重合的就是平行四边形.如果没说保证三点不共线就不能这么做,因为有可能4个点在一条直线上. #include<bits/stdc++.h> #define rep(i,a,b) for(int i=a;i<=b;i++) using namespace std; map<pair<int,int>,int>mp; ],y[]; int mai…
Number of Parallelograms CodeForces - 660D You are given n points on a plane. All the points are distinct and no three of them lie on the same line. Find the number of parallelograms with the vertices at the given points. Input The first line of the…
题目链接: D. Number of Parallelograms time limit per test 4 seconds memory limit per test 256 megabytes input standard input output standard output You are given n points on a plane. All the points are distinct and no three of them lie on the same line.…
You are given n points on a plane. All the points are distinct and no three of them lie on the same line. Find the number of parallelograms with the vertices at the given points. Input The first line of the input contains integer n (1 ≤ n ≤ 2000) — t…
D. Number of Parallelograms 题目连接: http://www.codeforces.com/contest/660/problem/D Description You are given n points on a plane. All the points are distinct and no three of them lie on the same line. Find the number of parallelograms with the vertice…
Number of Parallelograms time limit per test 4 seconds memory limit per test 256 megabytes input standard input output standard output You are given n points on a plane. All the points are distinct and no three of them lie on the same line. Find the…
D. Number of Parallelograms 原题链接 time limit per test 4 seconds memory limit per test 256 megabytes You are given n points on a plane. All the points are distinct and no three of them lie on the same line. Find the number of parallelograms with the ve…
Codeforce 660 D. Number of Parallelograms 解析(幾何) 今天我們來看看CF660D 題目連結 題目 給你一些點,求有多少個平行四邊形. 前言 @copyright petjelinux 版權所有 觀看更多正版原始文章請至petjelinux的blog 想法 注意到,只要有兩個等長的平行邊,那我們就找到了一個平行四邊形了. 所以只要用一個\(map\)紀錄每個線段出現的次數,且每次加入一個線段(我們枚舉線段)時,先把答案加上目前有多少等長平行線段,最後答案…