HDU 6055 Regular polygon (暴力)】的更多相关文章

题意,二维平面上给N个整数点,问能构成多少个不同的正多边形. 析:容易得知只有正四边形可以使得所有的顶点为整数点.所以只要枚举两个点,然后去查找另外两个点就好. 代码如下: #pragma comment(linker, "/STACK:1024000000,1024000000") #include <cstdio> #include <string> #include <cstdlib> #include <cmath> #inclu…
/* HDU 6055 - Regular polygon [ 分析,枚举 ] 题意: 给出 x,y 都在 [-100, +100] 范围内的 N 个整点,问组成的正多边形的数目是多少 N <= 500 分析: 分析可知,整点组成的正多边形只能是正方形 故枚举两个点,验证剩下两个点的位置 坑点: 由于点的范围是 [-100, +100],故经过计算得出的点的范围可能是 [-300,+300],注意越界 编码时长:46分钟(-1) */ #include <bits/stdc++.h> u…
Regular polygon Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 1529    Accepted Submission(s): 597 Problem Description On a two-dimensional plane, give you n integer points. Your task is to fig…
Regular polygon Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 2219    Accepted Submission(s): 880 Problem Description On a two-dimensional plane, give you n integer points. Your task is to fig…
题目链接 **Problem Description On a two-dimensional plane, give you n integer points. Your task is to figure out how many different regular polygon these points can make. Input The input file consists of several test cases. Each case the first line is a…
Regular polygon Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 2004    Accepted Submission(s): 795 Problem Description On a two-dimensional plane, give you n integer points. Your task is to fig…
http://acm.hdu.edu.cn/showproblem.php?pid=6055 [题意] 给定n个格点,问有多少个正多边形 [思路] 因为是格点,只可能是正方形 枚举正方形的对角线,因为有两条对角线,最后答案要/2 也可以枚举正方形的边,因为有四条边,答案要/4 看当前对角线确定的正方形是否存在,用几何知识求出目标点的坐标,然后二分查找目标点是否存在 [Accepted] #include <cstdio> #include <cstring> #include &l…
题目链接 有个结论: 平面坐标系上,坐标为整数的情况下,n个点组成正n边形时,只可能组成正方形. 然后根据这个结论来做. 我是先把所有点按照 x为第一关键字,y为第二关键字 排序,然后枚举向量 (p[i]->p[j]) (j>i),只判断这个向量左侧可否存在两个点与它一起构成一个正方形.这样算的结果是,计数每个正方形时,它的靠右和靠下的两条边都会为ans贡献一个单位,所以最后ans要除以2. #include<bits/stdc++.h> using namespace std;…
题目链接 给一个n个顶点的正多边形, 给出多边形内部一个点到n个顶点的距离, 让你求出这个多边形的边长. 二分边长, 然后用余弦定理求出给出的相邻的两个边之间的夹角, 看所有的加起来是不是2Pi. #include <iostream> #include <vector> #include <cstdio> #include <cstring> #include <algorithm> #include <cmath> #includ…
Problem Description On a two-dimensional plane, give you n integer points. Your task is to figure out how many different regular polygon these points can make.   Input The input file consists of several test cases. Each case the first line is a numbe…