Hdu 5365 Run (BC 50 B) (number of quadrilateral), hdu5365

Source: Internet
Author: User

Hdu 5365 Run (BC 50 B) (number of quadrilateral), hdu5365

I was prepared to go to bed, but I still couldn't help thinking about it because I have read the answer,

Question: it is to give you some coordinates, all of which are integers. Ask for the number of positive polygon. The official question is that people on earth know that the integer coordinates are not in a positive triangle, a positive Pentagon and a hexagonal shape... But I don't know... I will know later...

Therefore, this question can be directly violent, and the number of the positive quadrilateral is obtained. Here, we can determine whether the positive quadrilateral uses four sides to be equal, and the two sides are equal on the diagonal and the sides are smaller than the diagonal lines, I don't know if this is the right Quadrilateral (...)

Put the Code:

#include<iostream>#include<cstdio>#include<cstdlib>#include<cstring>#include<cmath>#include<vector>#include<set>#include<string>#include<algorithm>using namespace std;int solve(int a,int b,int c,int d){return (a-c)*(a-c)+(b-d)*(b-d);}int cmp(const void *a,const void *b){return *(int *)a - *(int *)b;}int main(){int n,i,j,k,p;int a[25],b[25],c[25];while(cin >> n){for(i=1; i<=n; i++)cin >> a[i] >> b[i];int ans = 0;for(i=1; i<=n; i++)for(j=i+1; j<=n; j++)for(k=j+1; k<=n; k++)for(p=k+1; p<=n; p++){c[0] = solve(a[i],b[i],a[k],b[k]);c[1] = solve(a[i],b[i],a[j],b[j]);c[2] = solve(a[i],b[i],a[p],b[p]);c[3] = solve(a[j],b[j],a[k],b[k]);c[4] = solve(a[j],b[j],a[p],b[p]);c[5] = solve(a[k],b[k],a[p],b[p]);qsort(c,6,sizeof(c[0]),cmp);if(c[0]==c[1]&&c[1]==c[2]&&c[2]==c[3]&&c[4]==c[5])ans++;}cout << ans << endl;} return 0;}


Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.