Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 430    Accepted Submission(s): 77

Problem Description
"You know what?" Angel said, "There is a love-letter from me embeded on the lawn. And if you can find it, it's for you~"
"How can I find it on such a big lawn?"
"I will show you a hint: start from that tree which is in center of this lawn, and run directly to (X,Y) point. Please memorize the distance you'v passed. Then turn left with a angle A degree, and go ahead for k times of the length you'v passed in the first step. k is a real number from 0 to 1. When you arrive, repeat to turn left, and run for k times as far as the length of the last step. After many many times, you will reach a place, where I embed my letter..."
Of cause, Gardon wouldn't follow her hint simply. He just run there directly. Can you do it?
 



Input
Input have serveral test cases. Each cases have for real number: X,Y,A,k
 



Output
For each case, print the place where the treasure is embed.
 



Sample Input
1 0 90 0.5
1 0 90 0
1 0 0 0.5
 



Sample Output
(0.800,0.400)
(1.000,0.000)
(2.000,0.000)
 
//by zyy
 
题目主要是向量的运算,用复数类complex比较方便,头文件为#include
向量(x+yi)向左转a角度,大小为原来的k倍,得到向量(x’+y’i)转换公式:
x’=x*cos(a)-y*sin(a);
y’=y*cos(a)+x*sin(a);
=>(x’+y’i)=k*(cos(a)+sin(a)i)*(x+yi);
可以看出成等比数列;
题目就是求它的和的极限。
既:(X,Yi)=(x+yi)/((1,0)-k*(cos(a)+sin(a)i));
 
 #include<cstring>
#include<complex>
#include<cmath>
#define pi acos(-1.0)
using namespace std;
typedef complex<double>Comp;
double x,y,A,k;
int main()
{
int i,j;
while(scanf("%lf%lf%lf%lf",&x,&y,&A,&k)!=EOF)
{
A=A*pi/180.0;
Comp a(x,y);
Comp b(-k*cos(A),-k*sin(A));
Comp c=a/b; printf("(%.3lf,%.3lf)\n",c.real(),c.imag());
}
return ;
}

HDU 1590 Searching(求复数向量和的极限)的更多相关文章

  1. hdu 5111 树上求交

    hdu 5111 树上求交(树链剖分 + 主席树) 题意: 给出两棵树,大小分别为\(n1\),\(n2\), 树上的结点权值为\(weight_i\) 同一棵树上的结点权值各不相同,不同树上的结点权 ...

  2. hdu 4717(三分求极值)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4717 思路:三分时间求极小值. #include <iostream> #include ...

  3. hdu 4548 筛法求素数 打表

    题目:http://acm.hdu.edu.cn/showproblem.php?pid=4548 Problem Description 小明对数的研究比较热爱,一谈到数,脑子里就涌现出好多数的问题 ...

  4. hdu 2870(dp求最大子矩阵)

    题意:让你求的是由同一字母组成的最大子矩阵,w可以变成a或者b,x可以变成b或者c,y可以变成a或者c,z可以变成a或者b或者c. 分析:这是hdu 1506.hdu 1505的加强版,具体的分析看我 ...

  5. hdu 1505(dp求最大子矩阵)

    题意:就是让你求出全由F组成的最大子矩阵. 分析:这是hdu 1506的加强版,只不过这道题变成了2维的,那我们就一行一行的来.具体的分析见1506的博客:http://www.cnblogs.com ...

  6. hdu 1506(dp求最大子矩阵)

    题意:容易理解... 分析:对于每个单位矩阵,我们先求出连续比它高的最左边的下标假设为l,然后求出比它高的最右边的下标假设为r,然后矩阵的面积就是(r-l+1)*1:我们从左到 右扫一遍,求出每个点的 ...

  7. Hdu 4738【求无向图的桥】.cpp

    题目: 曹操在长江上建立了一些点,点之间有一些边连着.如果这些点构成的无向图变成了连通图,那么曹操就无敌了.刘备为了防止曹操变得无敌,就打算去摧毁连接曹操的点的桥.但是诸葛亮把所有炸弹都带走了,只留下 ...

  8. hdu 2196(求树上每个节点到树上其他节点的最远距离)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2196 思路:首先任意一次dfs求出树上最长直径的一个端点End,然后以该端点为起点再次dfs求出另一个 ...

  9. hdu 2460(tarjan求边双连通分量+LCA)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2460 思路:题目的意思是要求在原图中加边后桥的数量,首先我们可以通过Tarjan求边双连通分量,对于边 ...

随机推荐

  1. ubuntu 14.04 (desktop amd 64) 安装和配置ROS Indigo

    安装ROS 配置Ubuntu的软件源 配置Ubuntu要求允许接受restricted.universe和multiverse的软件源,可以根据下面的链接配置: https://help.ubuntu ...

  2. (转)Attribute在.net编程中的应用

    Attribute在.net编程中的应用(一)Attribute的基本概念 经常有朋友问,Attribute是什么?它有什么用?好像没有这个东东程序也能运行.实际上在.Net中,Attribute是一 ...

  3. js和css兼容问题

    (一)html部分 1.H5新标签在IE9以下的浏览器识别 <!--[if lt IE 9]>  <script type="text/javascript" s ...

  4. C#中一个简单的匹配16进制颜色的正则测试

    using System; using System.Text.RegularExpressions; namespace Test { class Program { //匹配16进制颜色代码的正则 ...

  5. ubuntu , 安装包的具体文件的查看方法

    To see all the files the package installed onto your system, do this: dpkg-query -L <package_name ...

  6. 多个 CancellationTokenSource 复合(组合) 或 C# 使用 CancellationTokenSource 终止线程

    https://www.cnblogs.com/luohengstudy/p/5623451.html https://www.cnblogs.com/wlzhang/p/4604471.html

  7. memcached客户端连接建立过程笔记

    memcached在启动过程初始化server_sockets时,根据启动参数决定系统是进行tcp监听还是udp监听,这里暂时只关注tcp的情况. server_socket在初始化时会向系统申请监听 ...

  8. laravel 异常深度解析

    一.前言 做一件事,不仅要知其然,更要知其所以然.大部分的人都生活在别人设计的世界里,不是没有能力去更深一层,更进一步,而是因为自己懒得去思考.也许自己现在要做的就是:不要让自己舒服吧. 二.正题 1 ...

  9. linux中whereis、which、find、location的区别和用法

    摘自:https://www.cnblogs.com/kex1n/p/5233821.html 1. find find是最常见和最强大的查找命令,你可以用它找到任何你想找的文件. find的使用格式 ...

  10. C++中的this指针

    1.关于this指针的一个精典回答: 当你进入一个房子后,你可以看见桌子.椅子.地板等,但是房子你是看不到全貌了.对于一个类的实例来说,你可以看到它的成员函数.成员变量,但是实例本身呢?this是一个 ...