HDU 5365
2015-08-09 20:39
399 查看
Run
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 672 Accepted Submission(s): 293
Problem Description
AFA is a girl who like runing.Today,he download an app about runing .The app can record the trace of her runing.AFA will start runing in the park.There are many chairs in the park,and AFA will start his runing in a chair and end in this chair.Between two chairs,she
running in a line.she want the the trace can be a regular triangle or a square or a regular pentagon or a regular hexagon.
Please tell her how many ways can her find.
Two ways are same if the set of chair that they contains are same.
Input
There are multiply case.
In each case,there is a integer n(1 < = n < = 20)in a line.
In next n lines,there are two integers xi,yi(0 < = xi,yi < 9) in each line.
Output
Output the number of ways.
Sample Input
4
0 0
0 1
1 0
1 1
Sample Output
1
//求多少个正方形
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 672 Accepted Submission(s): 293
Problem Description
AFA is a girl who like runing.Today,he download an app about runing .The app can record the trace of her runing.AFA will start runing in the park.There are many chairs in the park,and AFA will start his runing in a chair and end in this chair.Between two chairs,she
running in a line.she want the the trace can be a regular triangle or a square or a regular pentagon or a regular hexagon.
Please tell her how many ways can her find.
Two ways are same if the set of chair that they contains are same.
Input
There are multiply case.
In each case,there is a integer n(1 < = n < = 20)in a line.
In next n lines,there are two integers xi,yi(0 < = xi,yi < 9) in each line.
Output
Output the number of ways.
Sample Input
4
0 0
0 1
1 0
1 1
Sample Output
1
//求多少个正方形
#include <stdio.h> #include <algorithm> using namespace std; int x[100]; int y[100]; int a[10]; int dist(int x,int y,int x1,int y1) { return (x-x1)*(x-x1)+(y-y1)*(y-y1); } int main() { int n; while(~scanf("%d",&n)) { for(int i=0;i<n;i++) { scanf("%d%d",&x[i],&y[i]); } int res=0; for(int i=0;i<n;i++) { for(int k=i+1;k<n;k++) { for(int j=k+1;j<n;j++) { for(int m=j+1;m<n;m++) { if(i!=k&&i!=j&&i!=m&&k!=j&&j!=m&&k!=m) { int cnt,flag; cnt=flag=0; a[0]=dist(x[i],y[i],x[k],y[k]); a[1]=dist(x[i],y[i],x[j],y[j]); a[2]=dist(x[i],y[i],x[m],y[m]); a[3]=dist(x[k],y[k],x[j],y[j]); a[4]=dist(x[k],y[k],x[m],y[m]); a[5]=dist(x[j],y[j],x[m],y[m]); sort(a,a+6); // for(int q=0;q<6;q++) // printf("%d ",a[q]); // printf("\n"); for(int p=1;p<6;p++) { if(a[p]!=a[p-1]) { cnt++; if(a[p]/a[p-1]==2) flag=1; } } if(cnt==1&&flag==1) res++; // printf("%d\n",res); } } } } } printf("%d\n",res); } return 0; }
相关文章推荐
- android 网络框架Android_Async_Http 初识
- Android系统UI设计之:视图
- 2015第32周日
- tomcat8编码
- uva 11525(单点修改)
- (15.1.11.3)听力之短文听写
- OC中内存管理
- 外包的一点浅见
- iOS 绘制1像素的线
- contiki中的CTK部件显示调试
- HDU 2553 N皇后问题
- iOS 绘制1像素的线
- iOS 绘制1像素的线
- Dom对象和Jquery对象区别详解
- 函数
- HDU 5285
- UVA 11573 - Ocean Currents【BFS+优先队列】
- CLRS 3.2标准记号与常用函数
- 内存空间的分类
- 线段树 poj3321 Apple Tree