Untitled


SUBMITTED BY: Guest

DATE: Jan. 23, 2016, 7:31 a.m.

FORMAT: Text only

SIZE: 1.3 kB

HITS: 1164

  1. nclude <iostream>
  2. #include <math.h>
  3. #include <algorithm>
  4. #include <stdio.h>
  5. #include <string.h>
  6. using namespace std;
  7. #define eps 1e-10
  8. #define maxn 310
  9. typedef struct point{
  10. double x,y;
  11. }p;
  12. p Point[maxn];
  13. double cross(point p1,point p2,point p0){
  14. return ((p1.x-p0.x)*(p2.y-p0.y)-(p1.y-p0.y)*(p2.x-p0.x))*0.5;
  15. }
  16. double max(double a,double b){
  17. if(a>b) return a;
  18. return b;
  19. }
  20. int main()
  21. {
  22. int n;
  23. while(~scanf("%d",&n)){
  24. for(int i=0;i<n;i++)
  25. scanf("%lf %lf",&Point[i].x,&Point[i].y);
  26. double ans=0,lmax=0,rmax;
  27. for(int i=0;i<n;i++){
  28. for(int j=i+1;j<n;j++){
  29. rmax=0,lmax=0;
  30. for(int k=0;k<n;k++){
  31. if(k!=i && k!=j){
  32. double s=cross(Point[i],Point[j],Point[k]);
  33. if(s<eps){
  34. lmax=max(lmax,-s);
  35. }
  36. else{
  37. rmax=max(rmax,s);
  38. }
  39. }
  40. }
  41. if(lmax==0 || rmax==0)continue;
  42. ans=max(ans,(rmax+lmax));
  43. }
  44. }
  45. printf("%lf\n",ans);
  46. }

comments powered by Disqus