Run Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) 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.
Input There are multiply case.
Output Output the number of ways.
Sample Input 4 0 0 0 1 1 0 1 1
Sample Output 1
Source
Recommend hujie | We have carefully selected several similar problems for you: 5390 5389 5388 5387 5386
|
#include <cstdio> #include <cmath> #include <queue> #include <iostream> #include <algorithm> #include <cstring> using namespace std; typedef long long ll; int a[10]; int distance1(int x,int y) { return x*x+y*y; } int main() { int n; int x,y; while(cin>>n) { int i,j,k,l; int x[21]; int y[21]; int res=0; memset(a,0,sizeof(a)); for(i=0; i<n; i++) cin>>x[i]>>y[i]; for(i=0; i<n; i++) for(j=i+1; j<n; j++) for(k=j+1; k<n; k++) for(l=k+1; l<n; l++) { a[0]=distance1(x[i]-x[j],y[i]-y[j]); a[1]=distance1(x[i]-x[k],y[i]-y[k]); a[2]=distance1(x[i]-x[l],y[i]-y[l]); a[3]=distance1(x[j]-x[k],y[j]-y[k]); a[4]=distance1(x[j]-x[l],y[j]-y[l]); a[5]=distance1(x[k]-x[l],y[k]-y[l]); sort(a,a+6); if(a[0]==a[1]&&a[1]==a[2]&&a[2]==a[3]&&a[4]==a[5]) res++; } cout<<res<<endl; } }
版权声明:本文为博主原创文章,未经博主允许不得转载。
原文:http://blog.csdn.net/sky_miange/article/details/47684255