UVa 10674 Tangents 求两圆公切线

题目地址:pdf版

直接用白书模板

个人以为,如果swap过后,应该放置一个标记位,这样才保证输出的a[i] 是第一个圆上的切点。

但是加上这段代码(程序中注释部分) wa,去掉反而ac。不知为什么。

代码:

#include<iostream>
#include<cmath>
#include<cstdio>
#include<algorithm>
#include<vector>
const long double eps=1e-10;
const long double PI=acos(-1);

using namespace std;


struct Point{
    long double x;
    long double y;
    Point(long double x=0,long double y=0):x(x),y(y){}
    void operator<<(Point &A) {cout<<A.x<<' '<<A.y<<endl;}
};

int dcmp(long double x)  {return (x>eps)-(x<-eps); }

typedef  Point  Vector;

Vector  operator +(Vector A,Vector B) { return Vector(A.x+B.x,A.y+B.y);}

Vector  operator -(Vector A,Vector B) { return Vector(A.x-B.x,A.y-B.y); }

Vector  operator *(Vector A,long double p) { return Vector(A.x*p,A.y*p);  }

Vector  operator /(Vector A,long double p) {return Vector(A.x/p,A.y/p);}



ostream &operator<<(ostream & out,Point & P) { out<<P.x<<' '<<P.y<<endl; return out;}
//
bool  operator< (const Point &A,const Point &B) { return dcmp(A.x-B.x)<0||(dcmp(A.x-B.x)==0&&dcmp(A.y-B.y)<0); }

bool  operator== ( const Point &A,const Point &B) { return dcmp(A.x-B.x)==0&&dcmp(A.y-B.y)==0;}


long double  Dot(Vector A,Vector B) {return A.x*B.x+A.y*B.y;}

long double  Cross(Vector A,Vector B)  {return A.x*B.y-B.x*A.y; }

long double  Le
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值