fork(1) download
  1. #include <cstdio>
  2. #include <math.h>
  3. #include <vector>
  4. #include <algorithm>
  5. #include <map>
  6. using namespace std;
  7. class Pt{
  8. public:
  9. long double x,y;
  10. Pt(){x=y=0;}
  11. Pt(long double a,long double b){x=a,y=b;
  12. }
  13. bool operator<(const Pt P) const
  14. {
  15. if(x!=P.x) return x<P.x;
  16. else return y<P.y;
  17.  
  18. }
  19.  
  20. Pt operator-(const Pt P)
  21. {
  22. return(Pt(this->x-P.x,this->y-P.y));
  23.  
  24.  
  25. }
  26. long double angle(){
  27. if(x==0) if(y>0) return 90;
  28. else return -90;
  29. else return atan(y/x)*180/3.141592653589793238L;
  30. }
  31. };
  32. int main()
  33. {
  34. int n;
  35. long double x,y;
  36. vector<Pt> polyg;
  37. scanf("%d",&n);
  38. while(n--){
  39. scanf("%f%f",&x,&y);
  40. polyg.push_back(Pt(x,y));
  41.  
  42. }
  43. printf("%d",polyg.size());
  44. map<long double,int> ct;
  45. for(int i=0;i<polyg.size();i++)
  46. {
  47.  
  48. ct.clear();
  49. for(int j=0;j<polyg.size();j++)
  50. {
  51.  
  52. if(j!=i) {//ct[(polyg[i]-polyg[j]).angle()]++;
  53. printf("%f\n",(polyg[i]).y);
  54. }
  55. }
  56. int a=0;
  57. int ans=100000;
  58. map<long double,int>::iterator it,jt;
  59. it=ct.begin();
  60. jt=ct.begin();
  61. for(;it!=ct.end();it++){
  62. a=0;
  63. while(jt->first < 180+it->first)
  64. {
  65. a+=jt->second;
  66. jt++;
  67. }
  68. if(a<ans) ans=a;
  69. a-=it->second;
  70.  
  71. }
  72. //printf("%d=",ans);
  73. }
  74. }
Success #stdin #stdout 0s 16056KB
stdin
3
0 0
0 1
2 1
stdout
30.000000
0.000000
0.000000
0.000000
0.000000
0.000000