UVa 11178 Morley's Theorem (向量旋转)
来源:互联网 发布:2015版淘宝下载安装 编辑:程序博客网 时间:2024/06/11 05:34
http://uva.onlinejudge.org/index.php?option=onlinejudge&page=show_problem&problem=2119
/*0.025s*/#include<cstdio>#include<cmath>struct P{double x, y;P(double x = 0.0, double y = 0.0): x(x), y(y) {}void read() {scanf("%lf%lf", &x, &y);}void output() {printf("%f %f", x, y);}};typedef P Vector;Vector operator + (const Vector &A, const Vector &B) {return Vector(A.x + B.x, A.y + B.y);}Vector operator - (const P &A, const P &B) {return Vector(A.x - B.x, A.y - B.y);}Vector operator * (const Vector &A, double p) {return Vector(A.x * p, A.y * p);}Vector Rotate(const Vector &A, double rad) {return Vector(A.x * cos(rad) - A.y * sin(rad), A.x * sin(rad) + A.y * cos(rad));}inline double Dot(const Vector &A, const Vector &B) {return A.x * B.x + A.y * B.y;}inline double Cross(const Vector &A, const Vector &B) {return A.x * B.y - A.y * B.x;}inline double Length(const Vector &A) {return hypot(A.x, A.y);}inline double Angle(const Vector &A, const Vector &B) {return acos(Dot(A, B) / Length(A) / Length(B));}inline P GetLineIntersection(const P &p1, const Vector &s1, const P &p2, const Vector &s2){return p1 + s1 * (Cross(s2, p1 - p2) / Cross(s1, s2));}P getP(P A, P B, P C){Vector v1 = Rotate(C - B, Angle(A - B, C - B) / 3);Vector v2 = Rotate(B - C, -Angle(A - C, B - C) / 3); /// 负数表示顺时针旋转return GetLineIntersection(B, v1, C, v2);}int main(){int T;P A, B, C;scanf("%d", &T);while (T--){A.read(), B.read(), C.read();getP(A, B, C).output(), putchar(32);getP(B, C, A).output(), putchar(32);getP(C, A, B).output(), putchar(10);}return 0;}
0 0
- UVa 11178 Morley's Theorem (向量旋转)
- UVA 11178 || Morley's Theorem (向量旋转求交点
- UVA 11178 - Morley's Theorem 向量
- UVA 11178 Morley's Theorem
- UVa 11178 - Morley's Theorem
- UVA 11178 Morley's Theorem
- Uva - 11178 - Morley's Theorem
- 【UVA 11178】 Morley's Theorem
- Uva 11178 Morley's Theorem
- UVA 11178 Morley's Theorem
- UVA 11178 Morley's Theorem
- uva-11178Morley's Theorem
- UVA - 11178-Morley’s Theorem
- uva 11178 Morley's Theorem
- UVA 11178 Morley's Theorem
- UVa 11178 Morley's Theorem
- UVa 11178 Morley's Theorem
- uva 11178 Morley's Theorem
- WAMPserver配置(允许外部访问、phpmyadmin设置为输入用户名密码才可登录等)
- php5.2
- APACHE服务器httpd.exe进程占用cpu100%的解决方法
- 安卓开发者必备的42个链接
- 安大校赛,“聪明的输入法”,字典树+树上状态记录
- UVa 11178 Morley's Theorem (向量旋转)
- java.util.Scanner类简介
- struts2如何返回json和处理json
- MySQL正则表达式使用——MySQL系列(四)
- android 软键盘Enter键事件处理
- VPS/云主机CPU占用100%故障排查
- Android网络通信方式
- 关于getObjectsUnderPoint的一个问题
- arm IT指令