zoukankan      html  css  js  c++  java
  • GSM Base Station Identification 2017南宁网络赛

     emmm......

     我上小学开始就不打小报告了

    emmm......

    话太多就变菜了

    emmm......

    四个小时上六次厕所真是辛苦你的前列腺了

     1 #include<bits/stdc++.h>
     2 #define cl(a,b) memset(a,b,sizeof(a))
     3 #define debug(a) cerr<<#a<<"=="<<a<<endl
     4 using namespace std;
     5 typedef long long ll;
     6 typedef pair<int,int> pii;
     7 
     8 const int maxn=50+10;
     9 const double r=5.0*sqrt(3.0);
    10 
    11 struct point
    12 {
    13     double x,y;
    14 };
    15 
    16 point p[maxn][maxn];
    17 
    18 void init()
    19 {
    20     p[10][10]= {0,0};
    21     for(int i=1; i<=10; i++)
    22     {
    23         p[i+10][10].x=p[i+9][10].x+r;
    24         p[i+10][10].y=0;
    25         p[-i+10][10].x=p[-i+11][10].x-r;
    26         p[-i+10][10].y=0;
    27     }
    28     double tmpx=r/2.0,tmpy=15.0/2.0;
    29     for(int i=-9; i<=10; i++)
    30     {
    31         for(int j=1; j<=10; j++)
    32         {
    33             p[i+10][j+10].x=p[i+10][j+9].x+tmpx;
    34             p[i+10][j+10].y=p[i+10][j+9].y+tmpy;
    35             p[i+10][-j+10].x=p[i+10][-j+11].x-tmpx;
    36             p[i+10][-j+10].y=p[i+10][-j+11].y-tmpy;
    37         }
    38     }
    39 }
    40 
    41 double dis(point a,point b)
    42 {
    43     return sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y));
    44 }
    45 
    46 point Search(point now)
    47 {
    48     double ans=100000;
    49     point res;
    50     for(int i=-9; i<=10; i++)
    51     {
    52         for(int j=-9; j<=10; j++)
    53         {
    54             if(ans>dis(now,p[i+10][j+10]))
    55             {
    56                 res.x=i,res.y=j;
    57                 ans=dis(now,p[i+10][j+10]);
    58             }
    59         }
    60     }
    61     return res;
    62 }
    63 
    64 int main()
    65 {
    66     init();
    67     int T=10;
    68     while(T--)
    69     {
    70         point now;
    71         scanf("%lf%lf",&now.x,&now.y);
    72         point ans=Search(now);
    73         printf("[%d,%d]",(int)ans.x,(int)ans.y);
    74         if(T) printf(", ");
    75         else printf("
    ");
    76     }
    77     return 0;
    78 }/*
    79 
    80 1 0
    81 0 15
    82 2 0
    83 13 7
    84 5 5
    85 10 15
    86 25 15
    87 -13 -8
    88 12 -7
    89 -10 0
    90 
    91 */
  • 相关阅读:
    http
    VUE-1
    AJAX
    html常用标签
    CSS网页布局
    概念整理3
    SEO
    概念整理2
    var
    概念整理
  • 原文地址:https://www.cnblogs.com/general10/p/7598096.html
Copyright © 2011-2022 走看看