Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //#pragma comment(linker, "/STACK:16777216")
- #include <fstream>
- #include <iostream>
- #include <string>
- #include <math.h>
- #include <set>
- #include <vector>
- #include <map>
- #include <queue>
- #include <stdio.h>
- #include <stack>
- #include <algorithm>
- #include <list>
- #include <memory.h>
- #define y0 sdkfaslhagaklsldk
- #define y1 aasdfasdfasdf
- #define yn askfhwqriuperikldjk
- #define j1 assdgsdgasghsf
- #define tm sdfjahlfasfh
- #define INF 100000000
- #define eps 1e-11
- #define M_PI 3.141592653589793
- //#define mx 1000000000000ll
- #define bs 1000000007
- //#define free asdfasdfsdadsg
- //#define szz 400
- //#define pb push_back
- #define MAXN 100000
- #define free afdshjioey
- //#define SIZE 60
- using namespace std;
- long n;
- struct point{double x,y;};
- long calc;
- vector<pair<point,int > > v;
- double x,y,r,xx1,ans,yy1,xx2,yy2,x1,y1,x2,y2,a,b,c;
- double dd,mult,ax,ay,bx,by;
- point p1,p2;
- bool cmp (pair <point, int> const & a, pair <point, int> const & b)
- {
- if (a.first.x>b.first.x)return true;
- if (a.first.x<b.first.x)return false;
- if (a.first.y>b.first.y)return true;
- return false;
- }
- int main(){
- //freopen("horseraces.in","r",stdin);
- //freopen("horseraces.out","w",stdout);
- //freopen("C:/input.txt","r",stdin);
- //freopen("C:/output.txt","w",stdout);
- ios_base::sync_with_stdio(0);
- xx1=yy1=0;
- xx2=yy2=1;
- a=y1-y2;b=x2-x1;
- c=x1*y2-x2*y1;
- n=500000;
- for (int i=1;i<=n;i++)
- {
- x=y=i;
- r=100;
- x1=xx1-x;x2=xx2-x;
- y1=yy1-y;y2=yy2-y;
- a=y1-y2;b=x2-x1;
- c=x1*y2-x2*y1;
- double tt=a*a+b*b;
- double x0 = -a*c/(a*a+b*b), y0 = -b*c/(tt);
- if (c*c > r*r*(a*a+b*b)+eps)continue;
- else if (fabs (c*c - r*r*(tt)) < eps) {
- continue;
- }
- else {dd = r*r - c*c/(tt);
- mult = sqrt (dd / (tt));
- ax = x0 + b * mult;
- bx = x0 - b * mult;
- ay = y0 - a * mult;
- by = y0 + a * mult;
- p1.x=ax+x;p1.y=ay+y;
- p2.x=bx+x;p2.y=by+y;
- if (cmp(make_pair(p1,0),make_pair(p2,0)))swap(p1,p2);
- v.push_back(make_pair(p1,0));v.push_back(make_pair(p2,1));
- }
- }
- sort(v.begin(),v.end(),cmp);
- cin.get();cin.get();
- return 0;}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement