HDU 6055 (2017 多校训练赛2 1011)Regular polygon
来源:互联网 发布:linux 查找文件关键字 编辑:程序博客网 时间:2024/06/16 19:03
2017 Multi-University Training Contest - Team 2 1011
Regular polygon
Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 0 Accepted Submission(s): 0
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 numbers N (N <= 500). The next N lines ,each line contain two number Xi and Yi(-100 <= xi,yi <= 100), means the points’ position.(the data assures no two points share the same position.)
Output
For each case, output a number means how many different regular polygon these points can make.
Sample Input
40 00 11 01 160 00 11 01 12 02 1
Sample Output
12
#include<stdio.h>#include<algorithm>#include<string.h>int aim[500][500];struct Point{ int x,y;}p[555];int solve(Point a,Point b){ int x=a.x-b.x; int y=a.y-b.y; int ans=0; if(a.x+y>=0&&a.y-x>=0&&b.x+y>=0&&b.y-x>=0&&aim[a.x+y][a.y-x]&&aim[b.x+y][b.y-x]) ans++; if(a.x-y>=0&&a.y+x>=0&&b.x-y>=0&&b.y+x>=0&&aim[a.x-y][a.y+x]&&aim[b.x-y][b.y+x]) ans++; return ans;}int main(){ int n; while(scanf("%d",&n)==1) { memset(aim,0,sizeof(aim)); for(int i=0;i<n;i++) { int a,b; scanf("%d%d",&a,&b); a+=200;b+=200; p[i].x=a; p[i].y=b; aim[a][b]=1; } int ans=0; for(int i=0;i<n;i++) { for(int j=i+1;j<n;j++) { if(i!=j) ans+=solve(p[i],p[j]); } } printf("%d\n",ans/4); }}
阅读全文
1 0
- HDU-2017 多校训练赛2-1011-Regular polygon
- HDU 6055 (2017 多校训练赛2 1011)Regular polygon
- HDU (6055)Regular polygon (2017多校训练赛1011)
- 2017 多校训练第二场 HDU 6055 Regular polygon
- 2017多校训练Contest2: 1011 Regular polygon hdu6055
- 2017多校训练第二场 hdu6055 Regular polygon (几何+暴力)
- HDU 2017 多校联合训练赛2 1011 6055 Regular polygon map&pair
- (2017多校2)1011/hdu-6055 Regular polygon(计算几何)
- HDU 2017 多校联赛2 1011 Regular polygon
- Regular polygon(HDU 6055)
- HDU-2017 多校训练赛6-1011-Classes
- HDU-2017 多校训练赛7-1011-Kolakoski
- HDU-2017 多校训练赛8-1011-Killer Names
- HDU-2017 多校训练赛10-1011-Two Paths
- HDU-2017 多校训练赛2-1009-TrickGCD
- HDU-2017 多校训练赛2-1003-Maximum Sequence
- HDU-2017 多校训练赛2-补题
- HDU-2017 多校训练赛2-1006-Funny Function
- 自定义线程池
- 20170727mabitas
- java web学习
- 如何自定义分块导出大图
- JAVA中常量使用常量类或者常量接口,还是使用枚举的区别
- HDU 6055 (2017 多校训练赛2 1011)Regular polygon
- Android6.0权限
- codeforces 802K Send the Fool Further! (medium) 树形dp
- Quartz与Spring里面实现定时器
- leetcode题解-392. Is Subsequence
- java基础习题50道(九)
- No Activity found to handle Intent报错原因。初学1.供大家分享。
- spark学习笔记之三:调度流程剖析
- Android的应用(APP)启动详细流程