1011 Regular polygon 6055之神奇的count与[]
来源:互联网 发布:如何把linux改为英语 编辑:程序博客网 时间:2024/06/03 20:52
2017 Multi-University Training Contest - Team 2 2017-7-27
Regular polygon
Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 1000 Accepted Submission(s): 368
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 11 061 00 00 12 11 12 0
Sample Output
12
找出所给点可以组成的所有正多边形
因为只有整数点,所以只有正方形
水
然鹅胖虎皱了皱眉头发现事情并没有那么简单
同样都是1000的数据量
count用时Process exited after 0.2823 seconds with return value 0
[ ] 用时Process exited after 1.369 seconds with return value 0
SURPRISE MOTHERFUCKER
#include<bits/stdc++.h>using namespace std;map<pair<int,int>,bool>have;int xx[1000000];int yx[1000000];int main(){int n = 1000;//puts("cnm");//while(~scanf("%d",&n)){have.clear();for(int i = 1;i <=n;i++){xx[i] = i,yx[i] = i;have[make_pair(xx[i],yx[i])] = 1;}int ans = 0;for(int i = 1;i<=n;i++){for(int j = i+1;j<=n;j++){int x1 = xx[i];int y1 = yx[i];int x2 = xx[j];int y2 = yx[j];int xd = x2-x1;int yd = y2-y1;//printf("%d %d %d %d\n",x1,y1,x2,y2);//printf("%d ",have[make_pair(x1-yd,y1+xd)]);//printf("%d \n",have[make_pair(x2-yd,y2+xd)]);//printf("%d ",have[make_pair(x1+yd,y1-xd)]);//printf("%d \n",have[make_pair(x2+yd,y2-xd)]);////if(have.count(make_pair(x1-yd,y1+xd)))if(have.count(make_pair(x2-yd,y2+xd)))ans++;if(have.count(make_pair(x1+yd,y1-xd)))if(have.count(make_pair(x2+yd,y2-xd)))ans++;//if((have[make_pair(x1-yd,y1+xd)] == 1)&&(have[make_pair(x2-yd,y2+xd)] == 1))//{//ans++;//}//if((have[make_pair(x1+yd,y1-xd)] == 1 )&&have[make_pair(x2+yd,y2-xd)])//{//ans++;//}//}}printf("%d\n",ans/4); } return 0;}/*60 00 11 01 12 02 160 00 12 02 11 01 161 01 12 02 10 00 1*/
#include<bits/stdc++.h>using namespace std;map<pair<int,int>,bool>have;int xx[1000000];int yx[1000000];int main(){int n = 1000;//puts("cnm");//while(~scanf("%d",&n)){have.clear();for(int i = 1;i <=n;i++){xx[i] = i,yx[i] = i;have[make_pair(xx[i],yx[i])] = 1;}int ans = 0;for(int i = 1;i<=n;i++){for(int j = i+1;j<=n;j++){int x1 = xx[i];int y1 = yx[i];int x2 = xx[j];int y2 = yx[j];int xd = x2-x1;int yd = y2-y1;//printf("%d %d %d %d\n",x1,y1,x2,y2);//printf("%d ",have[make_pair(x1-yd,y1+xd)]);//printf("%d \n",have[make_pair(x2-yd,y2+xd)]);//printf("%d ",have[make_pair(x1+yd,y1-xd)]);//printf("%d \n",have[make_pair(x2+yd,y2-xd)]);//////if(have.count(make_pair(x1-yd,y1+xd)))//if(have.count(make_pair(x2-yd,y2+xd)))//ans++;////if(have.count(make_pair(x1+yd,y1-xd)))//if(have.count(make_pair(x2+yd,y2-xd)))//ans++;if((have[make_pair(x1-yd,y1+xd)] == 1)&&(have[make_pair(x2-yd,y2+xd)] == 1)){ans++;}if((have[make_pair(x1+yd,y1-xd)] == 1 )&&have[make_pair(x2+yd,y2-xd)]){ans++;}//}}printf("%d\n",ans/4); } return 0;}/*60 00 11 01 12 02 160 00 12 02 11 01 161 01 12 02 10 00 1*/
阅读全文
0 0
- 1011 Regular polygon 6055之神奇的count与[]
- [HDU]-6055 Regular polygon
- 多校6055 Regular polygon
- hdu-6055-Regular polygon
- HDOJ 6055-Regular polygon
- Regular polygon HDU 6055
- hdu--6055--Regular polygon
- HDU 6055 Regular polygon
- hdu 6055 Regular polygon
- hdu 6055 Regular polygon
- HDU 6055 Regular polygon
- hdu 6055 Regular polygon
- hdu 6055 Regular polygon
- HDU 6055 Regular polygon
- HDU 6055 Regular polygon
- HDU 6055 Regular polygon
- HDU-6055 Regular polygon
- HDU-6055-Regular polygon
- C#两个DataTable拷贝问题:该行已经属于另一个表的解决方法
- velocity使用(一)--简介
- 李宏毅机器学习课程4~~~分类:概率生成模型
- VisualVM java监控工具
- HDU 6046 hash(搜索标识)
- 1011 Regular polygon 6055之神奇的count与[]
- 一些css选择器的使用
- PCIe学习笔记(27)--- PL
- iOS 下拉刷新-自定义
- Eclipse技巧
- C
- JSON转Map的几种方式
- HDU 6033 Add More Zero 数论 水题
- Spring源码学习(二):IOC容器在WEB容器中的初始化