UVa 12301 An Angular Puzzle 平面角度计算

该博客介绍了如何解决UVa 12301编程题,通过建立坐标系并以A(0,0),B(0,1)为基准,运用角度计算模板来求解问题。内容包括具体计算方法和代码实现。" 106273069,9070798,Qt编程:文本流与数据流操作详解,"['Qt开发', 'C++', '数据处理', '文件操作', '编程语言']
摘要由CSDN通过智能技术生成

题目地址:pdf版本

直接建立坐标系,设A(0,0) B(0,1)  然后就是利用模板进行计算了。

代码:

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

using namespace std;


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

int dcmp(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,double p) { return Vector(A.x*p,A.y*p);  }

Vector  oper
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值