"bzoj1913" apio2010-signaling signal coverage

Source: Internet
Author: User

http://www.lydsy.com/JudgeOnline/problem.php?id=1913 (Topic link)

Test instructions

gives the desired value of the points contained in a circle at any of the 3 points on a plane with n points.

Solution

This problem can be translated into convex polygon problem solving (of course I didn't think of it). Left-turn: http://blog.csdn.net/regina8023/article/details/45556321

Details

Note that the array that holds the polar angle is opened to twice times.

Code
bzoj1913#include<algorithm> #include <iostream> #include <cstdlib> #include <cstring># include<cstdio> #include <cmath> #include <queue> #define LL long long#define inf 2147483640#define EPS 1e-6#define Pi ACOs ( -1.0) #define FREE (a) freopen (a ".", "R", stdin), Freopen (a ". Out", "w", stdout), using namespace std; const int maxn=2000;struct Point {int x, y;} P[MAXN]; LL C[MAXN][MAXN];d ouble a[maxn<<1];int n;int Main () {scanf ("%d", &n), for (int i=1;i<=n;i++) scanf ("%d%d", & AMP;P[I].X,&AMP;P[I].Y); for (int i=0;i<=n;i++) c[i][0]=1;for (int. i=1;i<=n;i++) for (int j=1;j<=i;j++) C[I][J] =C[I-1][J]+C[I-1][J-1]; LL t2,t1=0;for (int i=1;i<=n;i++) {int cnt=0;for (int j=1;j<=n;j++) if (i!=j) {a[++cnt]=atan2 (p[j].y-p[i].y,p[j]. x-p[i].x); if (a[cnt]<0) A[cnt]+=2*pi;} Sort (a+1,a+cnt+1), for (int j=1;j<=cnt;j++) a[j+cnt]=a[j]+2*pi;for (int. j=1,k=1;j<=cnt;j++) {while (A[k+1]-a[j]   <pi && k<2*cnt) k++;t1-=c[k-j][2]; Number of convex polygons}t1+=c[n-1][3];}t2=c[n][4]-t1;printf ("%.6lf", (double) (t1+t2*2)/c[n][3]+3); return 0;} 

  

"bzoj1913" apio2010-signaling signal coverage

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.