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. 统计字符串中每个字符出现的次数(Python)

    #统计字符串中每个字符出现的次数 以The quick brown fox jumps over the lazy dog为例 message='The quick brown fox jumps o ...

  2. RabbitMQ入门_12_发布方确认

    参考资料:https://www.rabbitmq.com/confirms.html 通过 ack 机制,我们可以确保队列中的消息一定能被消费到.那我们有办法保证消息发布方一定把消息发送到队列了吗? ...

  3. JavaScript权威指南--事件处理

    知识要点 客户端JavaScript程序采用了异步事件驱动变成模型(13.3.2节).这种风格并不只应用于web编程,所有使用图形用户界面的应用程序都采用它,它们静待某些事件发生,然后响应. 事件就是 ...

  4. Codeforces 559B - Equivalent Strings

    559B - Equivalent Strings 思路:字符串处理,分治 不要用substr(),会超时 AC代码: #include<bits/stdc++.h> #include&l ...

  5. Java JDK5新特性-泛型

    2017-10-30 22:47:11 Java 泛型(generics)是 JDK 5 中引入的一个新特性, 泛型提供了编译时类型安全检测机制,该机制允许程序员在编译时检测到非法的类型. 泛型的本质 ...

  6. English trip -- VC(情景课)3 A Family

    xu言: 今天,老天很给面子.我在路上的时候基本上没有~然而我也没有带雨具.难道这就是传中的天道酬勤~或者说只要你努力,老天爷会给让路 Talk about the picture 看图说话 Look ...

  7. linux之CentOS7在线安装Mysql

    下载和添加仓库     1.wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm     2.sudo rpm -iv ...

  8. 20161226xlVBA演示文稿替换文字另存pdf

    Const ModelText As String = "机构名称" Const ModelName As String = "测试文件.pptx" Sub N ...

  9. Clear The Matrix CodeForces - 903F (状压)

    大意: 给定4行的棋盘以及4种大小的正方形方块, 每种各有一定花费, 每次可以选一种方块放在棋盘上, 棋盘对应格子全变为'.', 求最少花费使得棋盘全部变成'.' 状压基本操作练习, 状态取12位, ...

  10. Oracle11g温习-第四章:手工建库

     1.create database plan 1.库类型:   OLTP :  在线事务处理系统   OLAP : 在线应用处理系统   DSS :    数据决策系统 2.数据库名字及字符集 3. ...