Ural 1046 Geometrical Dreams
来源:互联网 发布:手游编程 编辑:程序博客网 时间:2024/06/06 14:28
Link To The Problem
Sokution : 用复数类可以使问题大大简化
Code:
#include<cstdio>#include<stack>#include<cmath>#include<iostream>#include<algorithm>#include<cstring>#include<queue>#include<map>#include<complex>using namespace std;#define nMax 300#define LL long long#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)#define CLR(a) memset((a),0,sizeof((a)))#define DB double #define pb push_back#define mp make_pair// ¿?¿?¿? C++ STLtypedef complex<double> Co;int n;Co M[nMax];double a[nMax];#define pi acos(-1.0)Co ans[nMax];int main() {freopen("in.txt","r",stdin);scanf("%d",&n);double u,v;rep(i,n) {scanf("%lf%lf",&u,&v);M[i] = Co(u,v);}rep(i,n) {scanf("%lf",&a[i]);a[i] = a[i]/180.0*pi;}Co x(1,0),y(0,0);rep(i,n) {Co b(cos(a[i]),sin(a[i]));x *= b;y -= M[i];y *= b;y += M[i];}y = -y;x -= Co(1,0);ans[0] = y/x;x=Co(1,0),y=Co(0,0);rep(i,n) {Co b(cos(a[i]),sin(a[i]));x *= b;y -= M[i];y *= b;y += M[i];ans[i+1]=x*ans[0]+y;}rep(i,n) {printf("%.2lf %.2lf\n",ans[i].real(),ans[i].imag());}return 0;}
- Ural 1046 Geometrical Dreams
- URAL 1046 Geometrical dreams 用复平面
- [复数 解析几何 || 随机化] Ural 1046 Geometrical Dreams & POJ 2600 Geometrical dreams
- poj 2600 Geometrical dreams 模拟退火
- Dreams
- Dreams
- Dreams
- 梦想 dreams
- Flying Dreams
- Follow Your Dreams
- Follow Your Dreams
- Follow Your Dreams
- I have many dreams...
- Boulevard of broken dreams
- strive for your dreams
- URAL
- 【ural】
- URAL
- 如何动态调整控件大小和隐藏控件显示
- 关于一道题的思考
- Lucene 学习资料
- php实现商品浏览记录
- GUI 主循环设计及其在 MiniGUI, GTK, QT 的实现
- Ural 1046 Geometrical Dreams
- Java Web中Session的理解
- ssh 远程问题—does not map back to the address
- RedHat设置SSH免密码登录
- Android应用:3D圆柱体
- Cocos2d-x游戏开发之CCLabelTTF标签详解之Create方法(设置自动换行的标签)和换行符的巧妙使用(十六)(高级篇)
- 莫欺少年穷
- 忘记root密码,修改的方法
- 关于动态链接库和静态链接库的一些总结