题意略。

思路:要你找出所有正多边形,其实是唬人的,整点的正多边形只有正方形,具体证明可以参考     2017国家队论文集-《正多边形》-杨景钦

详见代码:

#include<bits/stdc++.h>
#define maxn 505
//#define LOCAL
using namespace std; struct Point{
int x,y;
Point(int a = ,int b = ){
x = a,y = b;
}
Point operator+ (const Point& p){
return Point(x + p.x,y + p.y);
}
Point operator- (const Point& p){
return Point(x - p.x,y - p.y);
}
bool operator== (const Point& p) const{
return x == p.x && y == p.y;
}
bool operator< (const Point& p) const{
if(x != p.x) return x < p.x;
return y < p.y;
}
}; struct line{
Point s,t;
line(){}
line(Point a,Point b){
s = a,t = b;
}
bool operator< (const line& l) const{
if(!(s == l.s)) return s < l.s;
return t < l.t;
}
}; set<line> st;
Point store[maxn * maxn]; int main(){
#ifdef LOCAL
freopen("kkk.txt","r",stdin);
freopen("kkkout.txt","w",stdout);
#endif
int n;
while(scanf("%d",&n) == ){
st.clear();
for(int i = ;i < n;++i)
scanf("%d%d",&store[i].x,&store[i].y);
sort(store,store + n);
for(int i = ;i < n;++i){
for(int j = i + ;j < n;++j){
st.insert(line(store[i],store[j]));
}
}
int ans = ;
for(int i = ;i < n;++i){
for(int j = i + ;j < n;++j){
Point d = store[j] - store[i];
Point temp(d.y,-d.x);
Point s = store[i] + temp;
Point t = s + d;
if(st.count(line(s,t))) ++ans;
}
}
printf("%d\n",ans / );
}
return ;
}
05-20 11:32